Archived topic
customizing comments-link text?
4 replies · Started by MaryAnn on May 29, 2021
So, this is weird. I'm using this element:
<!-- wp:generateblocks/container {"uniqueId":"b6c5c5e5","paddingTop":"15","paddingRight":"0","paddingBottom":"15","paddingLeft":"0","marginTop":"20","marginRight":"20","marginBottom":"20","marginLeft":"0","borderSizeTop":"1","borderSizeBottom":"1","borderColor":"#e8edf0","showAdvancedTypography":true,"fontSize":14,"isDynamic":true,"gpInlinePostMeta":true} -->
<!-- wp:generateblocks/headline {"uniqueId":"a51661aa","element":"div","paddingRight":"10","inlineWidth":true,"gpDynamicTextType":"post-author","gpDynamicLinkType":"author-archives","gpDynamicTextReplace":"Author Name","gpDynamicTextBefore":"by "} -->
<div class="gb-headline gb-headline-a51661aa gb-headline-text">Author Name</div>
<!-- /wp:generateblocks/headline -->
<!-- wp:generateblocks/headline {"uniqueId":"3843ae49","element":"div","borderColor":"#e8edf0","paddingLeft":"10","borderSizeLeft":"1","inlineWidth":true,"gpDynamicTextType":"post-date","gpDynamicTextReplace":"Date"} -->
<div class="gb-headline gb-headline-3843ae49 gb-headline-text">Date</div>
<!-- /wp:generateblocks/headline -->
<!-- wp:generateblocks/headline {"uniqueId":"b5ba78d3","element":"div","borderColor":"#e8edf0","marginLeft":"10","paddingLeft":"10","borderSizeLeft":"1","hasIcon":true,"inlineWidth":true,"gpDynamicTextType":"comments-number","gpDynamicLinkType":"comments","gpDynamicTextReplace":"Comments","gpDynamicTextTaxonomy":"category","gpDynamicNoCommentsText":"no comments yet","gpDynamicSingleCommentText":"1 comment","gpDynamicMultipleCommentsText":"% comments"} -->
<div class="gb-headline gb-headline-b5ba78d3"><span class="gb-icon"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="1em" height="1em" viewBox="0 0 16 16"><path fill="currentColor" d="M14.2 14c.6-.5 1.8-1.6 1.8-3.2 0-1.4-1.2-2.6-2.8-3.3.5-.6.8-1.5.8-2.4C14 2.3 11.1 0 7.4 0 3.9 0 0 2.1 0 5.1c0 2.1 1.6 3.6 2.3 4.2-.1 1.2-.6 1.7-.6 1.7L.5 12H2c1.2 0 2.2-.3 3-.7.3 1.9 2.5 3.4 5.3 3.4h.5c.6.5 1.8 1.3 3.5 1.3h1.4l-1.1-.9s-.3-.3-.4-1.1zm-3.9-.3C8 13.7 6 12.4 6 10.9v-.2c.2-.2.4-.3.5-.5h.7c2.1 0 4-.7 5.2-1.9 1.5.5 2.6 1.5 2.6 2.5s-.9 2-1.7 2.5l-.3.2v.3c0 .5.2.8.3 1.1-1-.2-1.7-.7-1.9-1l-.1-.2h-1zM7.4 1C10.5 1 13 2.9 13 5.1s-2.6 4.1-5.8 4.1H6.1l-.1.2c-.3.4-1.5 1.2-3.1 1.5.1-.4.1-1 .1-1.8v-.3C2 8 .9 6.6.9 5.2.9 3 4.1 1 7.4 1z"></path></svg></span><span class="gb-headline-text">Comments</span></div>
<!-- /wp:generateblocks/headline -->
<!-- /wp:generateblocks/container -->
to customize the meta on my posts. And it works fine.
Its location rule is only set on posts, but unless I'm going absolutely crazy, it was also working to modify the comments-link text on my blog listing page:
https://www.flickfilosopher.com/all-recent-posts
Specially, instead of "Leave a comment" I'd like "no comments yet", and "1 comment" and "X comments" (lowercasing the "c" there, that is).
But I also don't want the author name in the blog listing, so I'm using this snippet to customize the display there:
add_filter( 'generate_header_entry_meta_items', function() {
return array(
'date',
'comments-link',
);
} );
add_filter( 'generate_inside_post_meta_item_output', function( $output, $item ) {
if ( '' === $item ) {
return '';
}
if ( 'comments-link' === $item ) {
return ' | ';
}
return $output;
}, 50, 2 );
And unless I'm absolutely going crazy, I'm sure the blog-listing page WAS showing "no comments yet," etc, until just a little while ago today.
Now, some other Disqus users are reporting a problem with comment counts: ie, some posts that do have comments are showing "no comments" in the post meta. My site is having that issue too. Could a Disqus problem be causing my blog-listing issue, or did I somehow just not notice that I was not, in fact, getting "no comments yet," etc, on the blog-listing page? And if that last is the case, how do I customize the comments-link text on the blog-listing page while keeping it otherwise looking as it is (which is somewhat different from the post meta on a post page)?
Hope that's not too confusing! Thanks for any help.
On poking around a bit in my Disqus settings, I think this might indeed be a problem on Disqus's end. But I'll leave this here for the moment in case you have any advice.
Hi there,
If you are using the dynamic post meta with block element already then you shouldn't need to use any of the filters there - everything should be handled within the block element.
I'm not using any blocks on the blog-listing page.
I'm reasonably confident now that this is a Disqus issue.
Ok sounds good :)