Forums

Trackbacks in sidebar, hide when none. (3 posts)

  1. picard102
    Member
    Posted 2 years ago #

    So what I have in my sidebar right now is

    <div class="track-side"><h3 id="pings">Trackbacks</h3>
    <ul>
    <?php wp_list_comments('type=pings&callback=mytheme_ping'); ?>
    </ul>
    </div>

    But I'd like it to not show up if there are no trackbacks or pings to display. I tried to use an if statement, but I don't think I targeted the right function as it doesn't display anything.

    Any help?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try:

    <?php if ( !empty($comments_by_type['pings']) ) : ?>
    <div class="track-side"><h3 id="pings">Trackbacks</h3>
    <ul>
    <?php wp_list_comments('type=pings&callback=mytheme_ping'); ?>
    </ul>
    </div>
    <?php endif;?>
  3. picard102
    Member
    Posted 2 years ago #

    Tried it, ends up not showing it at all even when it does have trackbacks.

Topic Closed

This topic has been closed to new replies.

About this Topic