[resolved] One post per page on index / multiple posts per page on archives (10 posts)

  1. Asitis
    Posted 6 years ago #

    I ran into the (appearantly frequent) problem of wanting to have 1 post on my frontpage/index but a list with multiple items on my archives page (or any other if it will).

    Now I could change the settings to display one post at a page, which works fine for the frontpage but also makes my archives one post per page which is kinda missing the point of an archive, eh?

    Then I figured to use Query_post, but that breaks the whole navigation system; Link

    I know allot of people have/had this question, but I can't seem to find any solution without strange workarounds or dubious plugins..

  2. MichaelH
    Posted 6 years ago #

    With the Settings->Reading Blog pages show at most at 5, using the WordPress Default theme, in wp-content/themes/default/index.php, just before this line: <?php if (have_posts()) : ?>

    add this to cause one (1) post on the 'index' posts display:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  3. Asitis
    Posted 6 years ago #

    Wow, that actually just did it - right out of the box.
    Thanks mate! :D I kinda already gave up hope for this to ever work. Let's hope this topic gets in the top hits on Google, because I know there are allot of people with the same problem!

  4. Asitis
    Posted 6 years ago #

    Hm, strange. I didn't do any work on the site this weekend, and now, for some reason, this technique still causes the navigation ( next_posts_link etc) to break and come up with a 404...

  5. Asitis
    Posted 6 years ago #

    I found out that any and all solutions on the WHOLE internets didn't work for me. Using the statement from MichealH only works for 1 page (when the counter hits /page/3 I still got a 404).

    I found out that none of the solutions work (anymore) - I guess it's a WP 2.8 thing. Whatever did worked (and still works!) is this plugin;

    Though it is written for 2.3, it still works with 2.8 and it works for me to achieve the simplest of things; display one post on the frontpage, more on any other.

  6. garethooper
    Posted 6 years ago #

    Tried the same string MichaelH advised on, but had the same problem from post three presenting a 404. Tried the plugin Asitis advised on it also works for me on WP2.8.3...So far so good.

  7. Doobus
    Posted 6 years ago #

    Holding my breath for a reply, seems that I always have problems that no one else has. I've tried this and at first it looked to have worked, but I too am having similar issues as garethooper and asitis. Well slightly different in that I'm not getting a 404, it's just the pagination keeps repeating the first set of posts. That and I don't have a 404 page.

    I know that the CQS plugin works, however in my case, it doesn't work with subcategories... I have two archive templates, one that shows 18 posts, and another 5... Why isn't this easily achievable? Or at the very least there is very limited documentation.

    The only thing I think may works is example 3. However I don't know how/where to plug the code, I keep getting parse error. Not to mention I don't know what to put in <-- put your loop here -->... I thought that was the loop.

    Sorry for long post any help is appreciated.

  8. 72Lakes
    Posted 6 years ago #

    Yeah, MichaelH's code worked for me. Except now, my 404 page doesn't work all. I am redirected to the homepage even if the URL is completely wrong. This is bad for SEO, I believe.

    Any ideas?

    @Doobus, Did you ever figure out where to place your 'example 3' code?

  9. 72Lakes
    Posted 6 years ago #

    404 oops Never mind. I can't believe I didn't notice that. My new theme didn't come with a 404.php I made one and everything works now. One post on home page and my 404 too. :)

  10. iriskao
    Posted 5 years ago #

    On mine (v 2.9.2) MichaelH solution won't go past page 4. Try this instead (also suggested by MichaelH in another thread)


    Works like a dream!

Topic Closed

This topic has been closed to new replies.

About this Topic