1 post on home page only?
-
Hello all,
Before I get too deep into things let me first explain what i’m trying to do with my layout, as there may well be a better way to do it that can be suggested.
What I need to do is make it so that my main page view displays only 1 post at a time. All other views, such as archive views, cat views, or tag views (I use UTW) should display 10 posts per page.
Now I got this for the most part working by using the query_posts function to limit the posts to 1 post when is_home is true. My Reading optinos in the blog is set to 10 posts per page. This set up at first appeared to work. My home page only showed 1 post, and the other pages properly showed 10 posts.
But then I clicked the Previous Post link on my home page, expecting to see the previous post but again only a single post on the page. What I got however was 1 post but it was the same post as the first page — that being the LATEST post. What I want to happen is to contiune displaying 1 post per page but obviously I want it to go next/previous post as it should.
I hope i’ve explained my situation well enough. I just gothome from a LOONG day at work and my brain cells are a tad fried.
Here is the code i’m using in my template index for the loop:
<?php
// If on the HOME page
if (is_home())
{
// Build a query that will display only categories 4 and 6, and only show 1 post
query_posts("cat=4,6&showposts=1");
}
?><?php if (have_posts()) : while (have_posts()) : the_post(); ?>
And of course the standard loop stuff after that.
EDIT: Those BRs aren’t in my code..don’t know why its showing them here *boggle*
- The topic ‘1 post on home page only?’ is closed to new replies.