• thebindlestick

    (@thebindlestick)


    Is there a way to edit the Loop on my index page to only display the most recent post in a given category, but let the rest of my pages like search and category archives still display the default 10? I have search and searched and tried several plugins, some of which crashed my site (thanks for that) but there has to be a simple code hack that doesn’t involve a plugin for something so simple, right? i am using 2.1 and only want to display the most recent post, with no Prev or Next links….

Viewing 3 replies - 1 through 3 (of 3 total)
  • Samuel B

    (@samboll)

    Thread Starter thebindlestick

    (@thebindlestick)

    That don’t work for 2.1, plus I was looking for a simple non-plugin hack for it. I found it:

    <?php
    if (is_home()) {
    query_posts(“showposts=1”);
    }
    ?>

    Dgold

    (@dgold)

    Nice work tracking down that code. Please keep telling how it works out. Is it 1 query to display the latest from each category, or simply the newest singular post?

    My answer was going to be, yes, you can do that with default WP and no plugins if you can get your hands dirty in the templates code. You’d set your # of posts to 10 in the admin, and you’d make a gnarly Main Index Template by-hand using custom queries and possibly custom CSS.

    I envisioned it with, say: 4 CSS areas, for 4 categories. Inside each area, the query code to display the most recent post in 1 certain category.

    Such as
    RECENT MOVIE | RECENT BOOK
    RECENT CONCERT | RECENT DIARY

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Number of Posts hack’ is closed to new replies.