Forums

What's wrong with my code? Trying to show posts that come from 2 categories? (4 posts)

  1. arcab4
    Member
    Posted 4 years ago #

    i am scratching my head on this one...

    but i am trying to show a posts (titles) only if it shows up in 2 specific categories. this is the code i used:

    <?php query_posts('cat=8'  && 'cat=53'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <span class="listings"><a href="<?php the_permalink(); ?>" title="Permanent link to <?php the_title(); ?>"><?php the_title(); ?></a></span>
    <?php endwhile;?>

    when i do this, this shows ALL my posts i've done.

    Thanks!

  2. moshu
    Member
    Posted 4 years ago #

  3. arcab4
    Member
    Posted 4 years ago #

    thanks moshu,

    i saw this section:

    query_posts('cat=2,6,17,38');

    that will show posts in categories 2,6, 17 and 18.

    what if i only want to show A POST that is only in category 2 and 6 only?

    thanks,

  4. arcab4
    Member
    Posted 4 years ago #

    if i can clarify it....

    i want to show a post that only shows up in category 2 AND 6. it has to be both categories. i don't want to show all posts in category 2 and then all posts in category 6. i want to show posts that i assigned to category 2 and 6.

    thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic