• I would like to be able to list all of the child categories underneath a specific category and display them with a title and description of what that category is. An example of how I would like it to display is here Link (the images are not necessary).

    All of the resources I have found so far… list_categories etc. Put the results into a UL or OL… Can someone point me in the direction of a custom category query or other plugin / resource that might be helpful?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mdesilets

    (@mdesilets)

    The code I was trying to work with…

    <?php wp_list_categories('orderby=id&show_count=10
    &use_desc_for_title=1&child_of=5'); ?> <?php echo category_description(5); ?>

    while this does list the categories… and the second part lists the description… they dont work together… I think I should be using a template but dont know where to start

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    WordPress doesn’t have any way to do what you’re asking. Look for a plugin to do it or write your own custom code to do it.

    Thread Starter mdesilets

    (@mdesilets)

    Otto,

    Thanks for your reply! I’ve almost solved my problem ?? now all I need is some styling and a pesky more link… Is there a cleaner way to do this?

    <?php
    $categories = get_categories("title_li=&orderby=name&hide_empty=0&child_of=5");
    foreach ((array) $categories as $cat) {
    $cat_link = '<h2 class="subhead1"><a href="' . get_category_link($cat->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $cat->cat_name) . '" ' . $rel . '>' . $cat->cat_name.'</a></h2>';
    ?>
    <p><?php echo $cat_link . '' . $cat->category_description; ?></p>
    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    I would have written it like this:

    <?php
    $categories = get_categories("title_li=&orderby=name&hide_empty=0&child_of=5");
    foreach ((array) $categories as $cat) {
    ?>
    <h2 class="subhead1"><a href="<?php echo get_category_link($cat->cat_ID); ?>" title="View all posts in <?php echo $cat->cat_name; ?>"><?echo $cat->cat_name; ?></a></h2>
    <p><?php echo $cat->category_description; ?></p>
    <?php } // end foreach loop ?>
    Thread Starter mdesilets

    (@mdesilets)

    that does make more sense… thank you again for your time

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Category Template with Descriptions’ is closed to new replies.