Forums

Conditional statements and common categories (3 posts)

  1. subirghosh
    Member
    Posted 4 years ago #

    I use this

    query_posts('cat=63,50');

    to display posts that belong to either/or all these categories.

    In a certain block I want to display items which are common to BOTH these two categories.

    I am using

    if ( in_category('50') || in_category('63') );
    $posts = get_posts('numberposts=5');
    if( $posts ) :
    foreach( $posts as $post ) : setup_postdata( $post );
    **** SHORT BODY TEMPLATE STUFF ****
    endforeach;
    endif;

    DOESN'T WORK.

    This displays posts from ALL categories on the site.

  2. subirghosh
    Member
    Posted 4 years ago #

    any ideas, anyone? :)

  3. ccoupe
    Member
    Posted 4 years ago #

    && instead of || ?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.