Forums

Removing <a href> from categories with 'show_count'=> 0, (2 posts)

  1. pinkkarma
    Member
    Posted 3 years ago #

    So.
    I'm doing a blog which is kinda like "open source book".
    I've listed the Index of my book as category listing on the left and will add posts under categories as I finish my book based on comments I get from readers and my own ideas.

    see an example from my idea here:
    http://www.teoblogi.com/

    I want my whole index to show on the left side, that people get the idea of the "structure" of the becoming book, but since I don't have material to post under each category yet I want those with a post count zero to show without a link (and without an post count)....and of course become active when I finally have a post written that I've linked under a certain non-active category.

    Is this possible? And how?

    with respect,
    T

    PS: Thanks for the possible help already:) I've been looking for an answer to this fairly long and finally when I lost all hope, I turned to the support forum. So hope this helps:)

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    Use the template tag, wp_list_categories(), with get_categories.

    <?php wp_list_categories('hide_empty=1&show_count=1&title_li=<h2>Categories</h2>'); ?>
    <?php
    $cats=get_categories ('hide_empty=0');
      foreach ( (array) $cats as $cat ) {
        if ( $cat->count == 0) {
          echo '<p>' . $cat->name . '</p>';
        }
      }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic