Support » Developing with WordPress » Hide Comment Count For Specific Custom Post Type On Blog Page

  • Resolved bward

    (@bward)


    On our blog page, I would like to hide or remove the comment count for a specific custom post type.

    I just cannot seem to figure this one out. This data is created via the content.php file and specifically, this is the content I would like to hide for only one custom post type. All others posts should display,

    <span class="date-sep"> | </span>
    <a href="<?php echo get_comments_link( $post->ID ); ?>">
    <?php comments_number( 'Comment', '1 Comment', '% Comments' ); 
    ?></a>

    Any help would be greatly appreciated!

    • This topic was modified 5 years, 7 months ago by bward.
    • This topic was modified 5 years, 7 months ago by bward.
    • This topic was modified 5 years, 7 months ago by bward.
    • This topic was modified 5 years, 7 months ago by bward.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Something like

    $pt = get_post_type();
    if ( 'mycpt' != $pt ) { 
       comments_number( 'Comment', '1 Comment', '% Comments' );
    }

    should do it.

    Thread Starter bward

    (@bward)

    Steve you are a genius! I made a couple changes to fit what I was doing specifically, but this absolutely worked. Thank you, thank you, thank you!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide Comment Count For Specific Custom Post Type On Blog Page’ is closed to new replies.