Custom category page listing subcat titles descriptions – how to?
-
Hello all,
First time poster, first WP blog – excited!
Anywho, I’m trying to set up a custom category page that will list:
Main category title and description
Subcategories titles (linked to subcat pages) and descriptionsI’ve had decent luck cobbling together code found on these here forums, there’s just one tiny problem I’m having I can’t seem to solve – in the subcats, there is no line break between the subcat title and subcat description, so it all just kinda runs together.
Here is the code I’m using:
<div id="cattoc"> <?php if ( is_category() ) : ?> <h1>Gnostic Myth + Magic</h1> <?php add_filter('category_description', 'wpautop'); ?> <?php add_filter('category_description', 'wptexturize'); ?> <div id="category-description"> <?php echo category_description(); ?> </div> <?php endif; ?></div> <ul id="catlist"> <?php $categories = get_categories("title_li=&orderby=name&style=none&show_count=1&child_of=82"); foreach ((array) $categories as $cat) { $cat_link = '<a href="' . get_category_link($cat->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $cat->cat_name) . '" ' . $rel . '>' . $cat->cat_name.'</a>'; ?> <li><?php echo $cat_link . '' . $cat->category_description; ?></li> <?php } ?> </ul>
Here’s the page:
https://www.enemies.com/category/gnostic-myth-magic/
Is this a CSS issue or a PHP/MySQl issue? ANy help would be much appreciated.
P.S. FWIW I’m also trying to figur eout how to shoehorn the code from the “category-icon” plugin in here somewhere too:
<?php if (function_exists('get_cat_icon')) get_cat_icon(); ?>
So that each subcat can also display a small image before the title, but that’s sometghing I haven’t attempted yet, so if I can kill two birds with one stone here, great, otherwise just one bird would be fine too ??
thx
Max
- The topic ‘Custom category page listing subcat titles descriptions – how to?’ is closed to new replies.