• Resolved graeme-mac

    (@graeme-mac)


    I have set up custom category templates naming the files “category-1.php” and so on. I am using the following code to pull the list of child categories and descriptions.

    <?php
    $categories = get_categories("title_li=&orderby=name&hide_empty=0&child_of=21");
    foreach ((array) $categories as $cat) {
    ?>
    
    <h2><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>
    <div style="border:1px #CCCCCC solid; margin:3px; padding:10px;">
    <?php echo $cat->category_description; ?>
    </div>
    <?php } // end foreach loop ?>

    When you click the child category link it takes you to a 404 page. Any help would be appreciated.

Viewing 1 replies (of 1 total)
  • Thread Starter graeme-mac

    (@graeme-mac)

    You know what I fixed it. You need to make sure you have posts in the sub category for the link to work.

Viewing 1 replies (of 1 total)
  • The topic ‘Link to Child Category not working’ is closed to new replies.