- This topic has 9 replies, 2 voices, and was last updated 7 years, 1 month ago by
Tom.
-
AuthorPosts
-
June 16, 2015 at 3:40 am #114890
Achim
Hi Tom,
I’d like to separate pingbacks from comments on post pages. Right now pingbacks are listed at the bottom of comment list. I’d like to have the headline „PINGBACKS“ just before pingbacks will be listed.
The order should be like this
headline „COMMENTS“
comment-list
headline „PINGBACKS“
pingpack-listAny help is welcome
Best’June 17, 2015 at 12:09 am #115086Tom
Lead DeveloperLead DeveloperHi there,
Doing this would require a custom comments.php file in your child theme.
Here’s an example of one: https://tommcfarlin.com/separate-comments-and-pingbacks/
So you would put that comments.php file into your child theme, and it will overwrite the theme’s comments.php file.
Let me know if you have any trouble 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 17, 2015 at 2:37 am #115112Achim
Thank you. I did follow the instructions of the example but it didn’t work. I replaced the comments.php and put the two other php files in the same folder. The result is that only both h3 headlines are being displayed including the number of comments. No comments, no pingbacks and no number of pingbacks are being displayed.
Any idea what to do?
June 18, 2015 at 6:57 am #115369Tom
Lead DeveloperLead DeveloperHmm, this is pretty tough.
Give this comments.php file a try: https://gist.github.com/generatepress/4b1cf22a773cdc0f06c5
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 19, 2015 at 2:48 pm #115642Achim
This is great! Works fine.
Thanks a lot Tom.Best’
June 19, 2015 at 4:35 pm #115647Tom
Lead DeveloperLead DeveloperNo problem 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 21, 2015 at 9:04 am #115897Achim
One more thing…
I want to have the pingback h3 headline only been shown if there are pingbacks. I tried this one but it doesn’t work
if ( ! empty($comments_by_type[‘pings’]) ) :How do I check for if the are pingbacks?
June 21, 2015 at 10:28 am #115900Tom
Lead DeveloperLead DeveloperHmm, good question..
You can try adding a function like this:
function generate_post_has( $type, $post_id ) { $comments = get_comments('status=approve&type=' . $type . '&post_id=' . $post_id ); $comments = separate_comments( $comments ); return 0 < count( $comments[ $type ] ); }
Then use this conditional around your trackback heading:
if ( generate_post_has( 'pings', $post->ID ) ) { ?> <h3>Pingbacks and Trackbacks</h3> <?php }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 21, 2015 at 1:23 pm #115903Achim
excellent!
Thank you Tom
June 21, 2015 at 10:57 pm #115942Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
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.