Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content_getter() returns all types of content without leading space #360

Closed
milanbx opened this issue Nov 8, 2018 · 4 comments
Closed
Labels

Comments

@milanbx
Copy link

milanbx commented Nov 8, 2018

When using any content in the post list (like author, excerpt etc.), the resulting HTML does not contain leading space to separate the content from date.
I think, the bug is in the content_getter() function in lcp-catlist.php file. It does not add an extra space in front of the content received. For case of author, tho line:
$info = $this->catlist->get_author_to_show($post);
should be replaced with:
$info = ' ' . $this->catlist->get_author_to_show($post);
to add the extra space.
I have learned this approach from another function get_modified_date(), which adds the space as following:
$info = " " . $this->catlist->get_modified_date_to_show($single);

Expected behaviour

Short code
[catlist name=news date_modified=yes excerpt=yes]
should produce (an example contents):
My latest post 8.11.2017 This news is about ...
The point is in the space between the content parts, date and excerpt.

Actual behaviour

But the resulting HTML does not generate space between date and excerpt:
My latest post 8.11.2017This news is about ...

Shortcode used and steps to reproduce the behaviour

[catlist name=news date_modified=yes excerpt=yes]

WP version, LCP plugin version (versions of other software if relevant, e.g. PHP)

WP version: 4.9.8
LCP version: 0.79
source code module: lcp-catlist.php
addressed function: content_getter()

Hope I'm right.
Milan

@milanbx
Copy link
Author

milanbx commented Nov 8, 2018

I may found a better solution: In get_stuff_with_tags_and_classes() function the leading space is added at the end:
return ' ' . $result;

@klemens-st
Copy link
Collaborator

The code you are referring to is going to be majorly refactored in #288.

The problem here is that I'm not so sure we should add this space because it's not useful in every case. For example if someone uses [catlist date_modified=yes date_modified_tag=div] the leading space is unnecessary.

But I agree that when using just [catlist date_modified=yes excerpt=yes] the default output is not the best.

Proposed solution: add a leading space only if _tag customization parameter is not used. What do you think @picandocodigo?

@milanbx A quick solution to use right now is to use [catlist date_modified=yes date_modified_class=lcp_date_modified excerpt=yes] and add the following CSS to your site:

lcp_date_modified {padding: 0 5px;}

or something similar.

@milanbx
Copy link
Author

milanbx commented Nov 12, 2018

OK, great, thanks for taking into consideration.

@stale
Copy link

stale bot commented Jun 18, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants