• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Nile Flores Media

Helping You Rock Out Your Website Like A Rockstar

  • Home
  • About
  • Blog
  • Portfolio
  • Hire Me
  • Resources
  • Contact
  • Blogging
  • WordPress
  • Social Media
  • SEO
  • Web Design
  • News
  • Podcast
You are here: Home » WordPress » How to Display Comments and Trackbacks Separately

How to Display Comments and Trackbacks Separately

By Nile Flores 1 Comment


If you’ve observed your WordPress comments for each of your blog posts, sometimes you see comments, and others are trackbacks. Trackbacks are links back from another post, on another website. If another blogger mentions your post, and links to it, then you will see this. With some themes, you can disable showing this.

However, if you like to keep them, but keep them separate from the comments, here’s how to do it.

How to Display Comments and Trackbacks Separately

1. Find the comments.php file of your theme.

2. Open the comments.php file and find the following code:

foreach ($comments as $comment) : ?>
    // Comments are displayed here       	 
endforeach;

3. Replace it with the following code:

<ul class="commentlist">
    <?php //Displays comments only
	foreach ($comments as $comment) : ?>
       	<?php $comment_type = get_comment_type(); ?>
       	<?php if($comment_type == 'comment') { ?>
	    <li>//Comment code goes here</li>
	<?php } 
    endforeach; 
</ul>

<ul>
    <?php //Displays trackbacks only
	foreach ($comments as $comment) : ?>
       	<?php $comment_type = get_comment_type(); ?>
       	<?php if($comment_type != 'comment') { ?>
	    <li><?php comment_author_link() ?></li>
	<?php } 
    endforeach; 
</ul>

You can style these as needed.


Filed Under: WordPress Tagged With: comments, display comments and trackbacks separately, trackbacks, wordpress tutorial

About Nile Flores

Nile is a 43-year old female from the greater St. Louis (Southern Illinois side) area. Nile is a mother of 1 son. She is also a web designer and developer, a graphic designer, and a public speaker, who exclusively designs and develops using WordPress. She also blogs at GoDaddy's Blog, Verpex Hosting's blog and her very personal sites, Pixelled and Nail Polish Happy.




Related posts:

No related posts.

Reader Interactions

Comments

  1. Eva Smith says

    September 11, 2020 at 1:26 am

    Nice blog post about how we can show comments on our WordPress blog and trackback them. Nice blog post keep the good work going.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow Me On:

  • Facebook
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube

Get The Latest WordPress & Blogging Tips

Sign up for my newsletter, and also get my free ebook on 10 Reasons Why Your Website Isn't Converting, and How to Fix it!




Try to be More Positive on Social Media

Note: You can click on image and view the video in a larger lightbox window.

Footer

The Blog

Lots of free information, tutorials, and more to help you bring your best foot forward with your website.

  • Blogging
  • WordPress
  • Social Media
  • SEO
  • Web Design

Get The Latest WordPress & Blogging Tips

Sign up for my newsletter, and also get my free ebook on 10 Reasons Why Your Website Isn't Converting, and How to Fix it!

Copyright © 2025 · · WordPress