• Hi there,

    I’ve really been struggling to get an answer to this that works. Basically, I have this page (www.rjt-online.com/wp/blog) that has a section on the right called Blog Archive which lists months of the year. When you click on the months, I want the archives to display only the “Blog” category, and not any other posts.

    Also, the “next post” and “previous post” would need to go to the next BLOG post and previous BLOG post aswell.

    Any ideas?

    I’ve tried various things with no luck so far.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You need to do a query_posts in the loop. I use something like it on my homepage that looks like this:

    <?php
    	$wp_query = $tmp_query;
    query_posts($query_string . '&cat=-26,-27');
    	if (have_posts()) :
    	$odd = false;
    	while (have_posts()) : the_post();
    	$odd = !$odd;
    	?>

    Note the third line where it says &cat=-26,-27
    This excludes those two categories from the display. You probably want something more like query_posts('cat=4');

    If you’re not sure what the category number is, go to categories, click on the category and look in the browser bar where it’ll say category&post_type=post&tag_ID=6 whereby the number is the category number.

    Take a look at the codex for more

    Thread Starter chrischickenwire

    (@chrischickenwire)

    That doesn’t seem to be working.

    It’s throwing an error:

    Parse error: syntax error, unexpected $end in /home/rjtonlin/public_html/wp/wp-content/themes/twentyten/archive.php on line 59

    Any idea?

    I pasted the code into the Loop in Archive.php

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Archive with posts from one category’ is closed to new replies.