WordPress.org

Ready to get started?Download WordPress

Forums

Creating an alternate index page? (3 posts)

  1. ebedgert
    Member
    Posted 5 years ago #

    I would like to create an alternate index page for my site but am not sure how to go about it. Ordinarily I might just duplicate the index.php (naming it something else) and edit it to my taste, but I have a problem - I only have the most recent 2 posts to displaying on my "real" index page (and these posts use the <!--more--> break to show the beginning paragraphs), but I want my alternate index page to show, say, the most recent 6 or 7 posts in full text versions... regardless of whether there are <!--more--> breaks in the posts.

    Right now I have my post display preferences (via the dashboard options) set to "2." But how would I override that on the alternate index page, so that I could show 7 posts? And how would I override the <!--more--> break? (Should I just use an excerpt field on my posts for the main index display, rather than the <!--more--> tag?)

  2. ebedgert
    Member
    Posted 4 years ago #

    Actually, I'm still just looking for some insight on how to create an alternate index page. Something that looks and acts very similar to my current index page but can be presented as a separate page. It's more involved than simply copying and renaming "index.php" to something else, right?

  3. s_ha_dum
    Member
    Posted 4 years ago #

    It's more involved than simply copying and renaming "index.php" to something else, right?

    Not much. Copy your index file. You were on the right track there. Use query_posts to override the post display limit and set $more to 1 to get full-texts. It should look like this:

    query_posts('showposts=-1');
    global $more;
    $more = 1;

    You might also be able to just put a switch inside the index file.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags