• Here is the code i am using for the categories,

    <?php
    $posted = get_posts( "category=" . $category[0]->cat_ID );
    if( $posted ) :
    	foreach( $posted as $post ) : setup_postdata( $posted );
    ?>

    It show’s only one of the categories, and it has a drop down menu of all post under that category, but i want the post to show all the categories and not just one.

    What would i have to change in the php code above to accomplish that.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Remove the code that explicitly sets the category then?

    <?php
    $posted = get_posts();
    if( $posted ) :
    	foreach( $posted as $post ) :
                setup_postdata( $post );
    ?>

    Thread Starter Terrellvanity

    (@terrellvanity)

    I’m sorry this is the category code i am using

    <?php echo $category[0]->cat_name; ?>

    I don’t think i follow your question..

    You said..

    but i want the post to show all the categories and not just one.

    If you want “all” categories, then you remove the piece of code that specifies a particular category (as i’ve done in the code i posted).

    If that’s not what you mean, please restate what the original question/query is, as i’m not sure i follow..

    Thread Starter Terrellvanity

    (@terrellvanity)

    ok here’s my site http://TerrellVanity.com

    when you look at the right hand side of the footer of the post it is as follows

    +(category)

    then when you click the category it is a drop down menu,

    the code only shows one category i want it to show multiple categories, so that when all the categories show you can click on them and see the drop down menu.

    Ok i think i see what you mean..

    Try this..

    <?php
    $c = array();
    foreach( $category as $cats )
    	$c[] = $cats->term_id;
    $posted = get_posts( 'cat=' . implode( ',', $c ) );
    if( $posted ) :
    	foreach( $posted as $post ) :
                setup_postdata( $post );
    ?>

    Is that what you had in mind?

    Thread Starter Terrellvanity

    (@terrellvanity)

    that code didn’t work either, it still shows one category

    In that case, i’ll need to see where $category is being defined, so i can get an idea of what’s in the variable.. please.. 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘How do i show multiple categories?’ is closed to new replies.