- This topic has 5 replies, 2 voices, and was last updated 11 months, 3 weeks ago by
Tom.
-
AuthorPosts
-
January 24, 2020 at 11:50 pm #1143285
Brooke.
The
generate_do_post_meta_item()
function ininc/structure/post-meta.php
seems to have a filter to modify the output for each post meta item except the comment link item. For example, if you look at the tag meta you’ll see:echo apply_filters( 'generate_tag_list_output', sprintf( '<span...
However, the comment link output looks like:
if ( $comments && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<span class="comments-link">';...
Can we add a
generate_comment_link_output
filter be added to a future version and is there a workaround for now?January 25, 2020 at 9:32 am #1143873Tom
Lead DeveloperLead DeveloperHi there,
I wish it was possible, but WordPress (for some reason) doesn’t have a function to
return
the comments link – we can onlyecho
it, which makes it impossible to filter.What about the output are you wanting to change?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJanuary 27, 2020 at 11:18 am #1146047Brooke.
Hi Tom,
You’re right, I did some digging and it seems we are waiting on this trac ticket (or similar) to be addressed before it’s possible to
return
the comments_link.I’m actually overhauling the whole post meta area quite a bit. I think I may be able to accomplish some of this with CSS alone but editing the output of the comments would help quite a bit too. Since I’m already modifying the post date and category link (to return a custom taxonomy) I’m wondering if replacing the whole
generate_do_post_meta_item
function would make sense here but eager to hear your thoughts.January 27, 2020 at 3:33 pm #1146244Tom
Lead DeveloperLead DeveloperYou can just add your own custom meta item:
add_filter( 'generate_header_entry_meta_items', function( $items ) { $items[] = 'custom-comments-link'; return $items; } ); add_action( 'generate_post_meta_items', function( $item ) { if ( 'custom-comments-link' === $item ) { // Your custom comments link in here. } } );
Hope this helps π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJanuary 27, 2020 at 6:41 pm #1146338Brooke.
Thanks Tom,
That actually solved both the comments output as well as the hacky way I was previously outputting my custom taxonomy.
January 27, 2020 at 7:32 pm #1146375Tom
Lead DeveloperLead DeveloperAwesome! Glad I could help π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.