WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How to break posts into pages with 25 posts per page?

[Resolved] How to break posts into pages with 25 posts per page?

  • Moderator t-p

    @t-p

    Hi,

    I use the following function to list all archive posts.

    /archive”>

    How can I break posts into pages with say 25 posts per page?

    Your help will greatly be appreciated. Thanks

Viewing 15 replies - 1 through 15 (of 31 total)
  • I am not familiar with that function. Does the setting under Admin->Settings->Reading->’Blog pages show at most ___ posts’ work?

    Moderator t-p

    @t-p

    Thanks vtxyzzy,

    This is different. For some reason I was unable to paste the whole function yesterday. I am going to try again.

    <blockquote”<?php bloginfo(‘url’) ?>/archive”>Full Archive
    it displays a complete list of all posts by title.

    Now they all show on one page. I just want to break them down between 10 to 25 on a page.

    Use the “code” button (next to b-quote) or put code inside backticks (as indicated at the bottom of the reply box), when posting code in the forum… 😉

    Moderator t-p

    @t-p

    Thanks t31os, here it is:

    `<li<?php
    if (is_page(‘Archive’))
    {
    echo ” id=\”current\””;
    }?>>
    /archive”> Archive Titles

    Edit: still did not show up all of it. But the missing piece is in the previous post.

    Forgive me, but it’s not clear what the code is you’re using, nor what it is you want to do with it.

    Moderator t-p

    @t-p

    Thanks t31os,

    This just a link in the menu, if clicked it shows a list of all archive post (by title). Then the user can click on the title to see the full text of that title. That’s all.

    Please forgive my ignorance, I am going to try post the function again:

    <li><a href="<?php bloginfo('url') ?>/archive">Full Archive</a></li>

    Ok, but the link to the arhive doesn’t have anything to do with what happens on the archive page, so i’m still a little puzzled how that relates to your original question.

    Can you clarify please.

    Moderator t-p

    @t-p

    Thanks t310os for your patient with this non-geek/no-coder/non-dev.

    At present the shows all post on poge (this makes it qite a lenthy list).

    I am just trying to break the list down into pages with 25 items (that is, titles of posts) per page.

    If you posts are on an ‘Archive’ page, you might be able to use the Different Posts Per Page plugin.

    Moderator t-p

    @t-p

    thanks vtxyzz,

    I try to stay away from plugins.

    I thought may be I can do somthing simple as:
    bloginfo(‘url&limit_per_page=20’

    so if there is simple function something that, please tell me. Thanks

    You are missing a good thing if you don’t use plugins. The answer to a lot of questions is to use a good plugin.

    The bloginfo(‘url’) is just returning the URL to the blog so it can be used to find full URL to the archive template. It doesn’t have any parameters, and doesn’t affect the way the archive is displayed.

    Moderator t-p

    @t-p

    Thanks vtxyzzy

    I will look into plugins.

    Meanwhile, is there a something this sort of code:

    bloginfo(‘url&limit_per_page=20’)

    Thanks

    Open up your archive.php for your theme, find this line..

    if(have_posts()) :

    Look to see if there’s a query_posts() call before that, if not go ahead and add the following before that line…

    // Globalise the wp_query variable to get the already set vars
    if(!wp_query) global $wp_query;
    // Merge a new parameter with the existing ones into the query
    query_posts( array_merge( array( 'posts_per_page' => 25 ) , $wp_query->query ) );

    Does that help?

    Moderator t-p

    @t-p

    Thanks t31os,

    That did not break the list in 25 per page.

    I guess there has to be a simple solution somthing like this:

    <?php bloginfo(‘url&per_page=25’) ?>

    I am afraid that you are in for disappointment if you insist on looking for that. bloginfo does not do that.

    t31os_ is on the right track. I don’t understand why that didn’t work, unless the posts are being displayed by something other than archive.php.

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘[Resolved] How to break posts into pages with 25 posts per page?’ is closed to new replies.
Skip to toolbar