Viewing 5 replies - 1 through 5 (of 5 total)
  • Well, everything is there – but if you cannot make it work for you, this https://www.ads-software.com/support/topic/49006#post-269672 was just posted recenly as an alternate solution.

    Thread Starter bornfamous

    (@bornfamous)

    Here’s where I put the query_posts tag, but it doesn’t work:

    <?php query_posts(‘cat=1’); ?>
    <?php if ($posts) { ?>
    <?php foreach ($posts as $post) : start_wp(); ?>
    <?php require(‘post.php’);?>
    <?php endforeach; ?>

    Thread Starter bornfamous

    (@bornfamous)

    Can anyone spot what I did wrong in the code above?

    I use the following (in my not yet visible site in development).

    When I only want to show category 2:
    $wp_query->set(‘cat’, ‘2’);
    query_posts(”);

    And then the loop starts:
    if (have_posts()) : while (have_posts()) : the_post();

    And so on. Note: this will display posts that are in cat 2, but also posts that are also in cat 2.

    Thread Starter bornfamous

    (@bornfamous)

    It worked! Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘query-posts to display only one category on main page’ is closed to new replies.