Support » Fixing WordPress » List of category by get_the_category

  • Hi,

    Sorry for my english, at first!

    I have, problem with code it goes like this:

    <?php if ( is_category('8') ) {
    	       	foreach (get_the_category() as $category); ?>
    	       	<h2><?php echo $category->cat_name; ?></h2>
        	   	<p><?php echo $category->category_description; ?></p>

    What I need is to display on page list of sub-sub-categories. On my blog there is category “NUMBERS” under this category there is category NUMBER 1, under this sub-cat, there is sub-sub-category NUMBER 1-1, NUMBER 2-2, NUMBER 3-3

    NUMBERS – (0 pots)
    – NUMBER 1 – (0 pots)
    — NUMBER 1-1 – (10 pots)
    — NUMBER 2-2 – (10 pots)
    — NUMBER 3-3 – (10 pots)

    On each ssub-sub-czategor i have about 10 post, when i click on NUMBERS category (link) i get list of 30 posts (chronlogical but ungroup) this list is generate by THE LOOP.

    What I need is to get a lists of sub-sub-categories in any order, but with:

    name, description, image.

    When i use code above i get only first sub-sub-category (NUMBER 1-1) witch is last added cat (with posts).

    I can’t use wp_category_list becouse there is no description, and I can’t put name, descriprion or img into specified div tags witch i need to show.

    To be more clear:

    I click on category NUMBERS -> on main page I need to display list of sub-sub-categories with name, description and image, then i click on sub-sub-cat and I get posts (posted uder this sub-sub-cat).

    <?php if ( is_category('8') ) 
    //show me sub-sub-cat from CATEGORY 8
    <?php } else { ?> //if I don't cilick on category 8 show me posts from category I've cliked
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    //showing posts

    Any ideas?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘List of category by get_the_category’ is closed to new replies.