Problem creating a page to display a list of categories with post counts (2 posts)

  1. Xblue02
    Posted 2 years ago #

    Hi, I'm starting a new project and part of my idea requires me to create a page to list all of my categories and show how many posts are in each category. I have done some research with limited success, what I am using now is:

    <?php wp_list_categories('orderby=name&show_count=1'); ?>

    I have this wrapped in an unordered list tag

    Unfortunately it does not display anything.

    Here is a link to the webpage http://www.meanjoke.com/

    Any help will be greatly appreciated.

  2. Demetrius Pop
    Posted 2 years ago #

    Nice looking site.

    Drop this between your ul tags:

      'orderby' => 'name',
      'order' => 'ASC'
      foreach($categories as $category) {
        echo '<p>CATEGORY NAME OR WHAT EVER GOES HERE <br /> <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> ';
        echo '<p> DESCRIPTION OR WHATEVER GOES HERE:'. $category->description . '</p>';
        echo '<p> NUMBER OF POST HEADING OR WHATEVER GOES HERE: '. $category->count . '</p>';  }

    Please let me know how this works out.
    DemetriusPop ~

Topic Closed

This topic has been closed to new replies.

About this Topic