• Hi,
    On my site I have 5 categories. I want to have only one category (name ‘news’, ID=123) displayed on home page (other four will be available via categories list in sidebar).
    I decided to use query_posts (I don’t want to use plugins) but I’ve spent few hours on it and it’s still mystery for me.
    It doesn’t work when I use “cat=123” but it works fine when I use “category_name=news”. So just above the loop (<?php if (have_posts()) : while (have_posts()) : the_post(); ?>) I’ve inserted <?php query_posts('category_name=news'); ?>. I’ve 5 post being displayed per page and category news has alredy 12 posts. When I navigate to next page (via Older Posts >> link) it shows the same posts as on front page. So in the end I have three pages with the same 5 posts.
    Finally I decided to try soultion from this thread. It works (no posts repeated on further pages) although even there I had to change cat=123 to category_name=news.
    At this moment I only have theoritical question (since I got what I want ?? -> why cat=ID doesn’t work and why using the most obvious solution (`<?php query_posts(‘category_name=news’); ?>’) causes posts to be ‘copied’ on next pages? Am I missing sth? Should I have add sth more to index.php?
    Will be very satisfied ?? if anyone can explain this mystery for me.
    Thanks in advance!

Viewing 1 replies (of 1 total)
  • TimeMachine

    (@timemachine)

    You need to preserve the original query to get pagination to work.

    query_posts($query_string.”&category_name=news”);

Viewing 1 replies (of 1 total)
  • The topic ‘calling out cat=ID doesn’t work’ is closed to new replies.