- This topic has 9 replies, 2 voices, and was last updated 3 years, 12 months ago by Tom.
-
AuthorPosts
-
March 29, 2020 at 6:50 am #1218377Lee
Hi. I have a few questions about GP functionality.
1.
I would like to add a link to the content of the post in the “Preview article (summary)” of the blog. (Even if I click “Preview post (summary)”, I want to move to the post just like clicking on the title, image, “Read more”, and date.)
I am wondering if there is any relevant PHP code.2.
This is a question about a blog comment.
How can I change the text of “Leave a comment” and “Comments”?3.
This is a question about a blog comment.
“Leave a comment” is not visible when there is no comment, but I am wondering if it is possible to make a comment appear like “1 Comments” when there is a commentMarch 29, 2020 at 4:27 pm #1218946TomLead DeveloperLead DeveloperHi there,
1. I’m not too sure what you mean here. Are you wanting to allow links in the post excerpts?
2. Are we talking about these words in the post meta, or above/inside the comments area on each single post?
3. In the post meta? “Leave a comment” should appear if there are no comments, then “x Comments” should appear when a comment exists. I’m seeing this on your blog right now – the post at the bottom left says “3 Comments”, while the others say “Leave a comment”.
Let me know π
March 29, 2020 at 4:55 pm #1218957LeeThank you for answer.
1. Yes, it is. I want to go to the post by clicking on “post excerpts”.
2. Yes, it is. I want to change the text shown in archives and single posts.
3. In short, I would like to make the “Leave a comment” area invisible when there are no comments on the post.
March 30, 2020 at 9:51 am #1219810TomLead DeveloperLead Developer1. Do you have examples of this I can check out? I’m not sure I fully understand what’s needed.
2. Try this:
add_filter( 'gettext', function( $text, $original, $domain ) { if ( 'Leave a comment' === $text && 'generatepress' === $domain ) { $text = 'Your new text'; } if ( '1 Comment' === $text && 'generatepress' === $domain ) { $text = 'Your new text'; } if ( '% Comments' === $text && 'generatepress' === $domain ) { $text = 'Your new text'; // Use % in place of the number of comments. } }, 10, 3 );
3. Try this:
add_filter( 'generate_show_comments', function( $show ) { if ( ! get_comments_number() ) { return false; } return $show; } );
Let me know π
March 30, 2020 at 4:51 pm #1220184LeeThank you for answer.
Case 1
In “Blog Archive”, the class name is “wp-show-posts-entry-summary”. I wish I could see the content of the post by clicking on this part.Currently, there are multiple links to a single item in the “Blog Archive”, such as title, image, date and comment. It’s best to combine this link into one, but it seems like it’s not possible, so I’d like to link to the “Written example”.
So I can’t find a deserved example. Normally, there is only one tag that wraps an entire item.
Case 2
When applied to “snippets,” it seems to affect the text on the WordPress admin page. So it seems difficult to apply.Case 3
It works just fine!March 31, 2020 at 9:13 am #1221042TomLead DeveloperLead Developer1. This is pretty difficult unless you do something like this:
.wp-show-posts-entry-title a:before { position: absolute; top: 0; right: 0; bottom: 0; left: 0; content: " "; } .wp-show-posts-inner { position: relative; }
2. I adjusted the code above – can you give it another shot?
March 31, 2020 at 9:53 pm #1221645Leethank you for the reply.
The problem with the first question has been fixed. Everything works fine in “Blog Archive” as well as “WP Show Posts”.
However, in the case of the second question, even if the above code is applied, some characters on the WordPress admin page and the page created with “WP Show Posts” will still disappear. If you see the code presented by the administrator not working, it seems that there is a problem with my site. So, I decided to subtract the part related to comments from the page produced by “WP Show Posts”.
Thank you very much for helping with the above question.
April 1, 2020 at 10:02 am #1222429TomLead DeveloperLead DeveloperIs everything working as it should now, or are you still needing to adjust something?
Let me know π
April 1, 2020 at 4:39 pm #1222856LeeNo problem now!
Thank you.April 2, 2020 at 8:47 am #1223752TomLead DeveloperLead DeveloperYou’re welcome π
-
AuthorPosts
- You must be logged in to reply to this topic.