WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Different number of posts on different pages (14 posts)

  1. TonyGeer
    Member
    Posted 8 years ago #

    Hi I tried searching the archives and came up with some similar stuff which wasn't exactly what I'm looking for. What I want is this: on my main page (of the site), I want the one or two most recent posts. On another page, which will probably be the main blog page (index.php) I'd like a larger number.

    I know for the second page I can configure this in wordpress. The first page is the problem.

    Can anyone help? Using the latest version of WordPress as of now. Thanks for reading.

  2. moshu
    Member
    Posted 8 years ago #

    What I want is this: on my main page (of the site), I want the one or two most recent posts.

    What is that main file/page? Created with WP? And if that is the main - I guess it has to be some kind of index... so how will you call the blogindex "index.php", too?
    Is WP installed in a subfolder or in the root?
    The more info you give the easier for somebody to answer.

  3. TonyGeer
    Member
    Posted 8 years ago #

    Sorry I didnt supply enough information for anyone to help me. This is the complete scenario:

    Word press installed on the root of the site. The default for this will remain index.php. I only want the two most recent posts showing up (I know I can do this in wordpress).

    On another section of the site, it could be a wordpress Page, I want the top 20 (or any other variable number I can configure).

    I realise that the Archives page could be used for this, but that page only lists the categories and the by month posts.

    So bascially what I'm looking for is a way to have the archives page list X most recent posts.

  4. moshu
    Member
    Posted 8 years ago #

    1. admin > Options > Reading: Show at most...
    2. "top" or "most recent" X number of posts? (it's not the same...)

    Using the Template_Tags/wp_get_archives with the proper parameter might do what you want.

  5. TonyGeer
    Member
    Posted 8 years ago #

    Hi moshu, thanks for the replies so far. I'd like the 20 most recent post to show on the archives page. I'd like to have the posts showing just as they normally would on the main page, not just the title or anything like that.

    I've checked the template tags but I dont think it's possible using them.

    Anyone know how this can be done?

  6. moshu
    Member
    Posted 8 years ago #

    OK, then forget the Page, just use the normal archive.php template (actually WP "knows" how to use it, you don't have to do anything) and use a plugin that will let you to have different number of posts on different views:
    http://mattread.com/archives/2005/03/custom-query-string-plugin/

  7. spencerp
    Member
    Posted 8 years ago #

    EDITED* Just use the one moshu said above... =)

    spencerp

  8. moshu
    Member
    Posted 8 years ago #

    But the one I linked to has a nice admin interface ;)

  9. spencerp
    Member
    Posted 8 years ago #

    Re-Edited* Oh ok, just went to the project page now, it is..awesome!! Downloading it now!!

    But the one I linked to has a nice admin interface ;)

    Haha..sorry bout that moshu, I'll have to check that one out myself then lol! =) Thanks for it, I'll bookmark it now.. :)

    spencerp

  10. Kafkaesqui

    Posted 8 years ago #

    I consider Matt Read's plugin (i.e. moshu's link above) to have long ago superceded Custom Posts Per Page. It does everything CPPP (hmm) can, and much more.

  11. TonyGeer
    Member
    Posted 8 years ago #

    Thanks for the linkage guys. I'm using the default archives.php from the Kubrick theme as the template for my Archives page.

    How I did this was to create a new WordPress Page, as set it to use the Archives template. It has archives by month and archives by category in it.

    However I've set conditions for is_archive, is_month and is_category and none of them are working. Im using the newest version of wordpress.

    Is it because I've created a page from the archives template and not used the archives.php directly that it's not working?

    Thanks for your help so far.

  12. Kafkaesqui

    Posted 8 years ago #

    Note the difference between moshu's reference of archive.php (which is for displaying date-related archive queries), and your mention of archives.php (which is a Page template).

    If you need to set up a Page to display post archives, I'd suggest looking at the info on query_posts():

    http://codex.wordpress.org/Template_Tags/query_posts

  13. moshu
    Member
    Posted 8 years ago #

    You are not reading carefully - but you are not the first one ;)
    There are 2 template files in your theme with very similar names:
    archive.php
    archives.php

    Notice the plural S at the end of the second one. That's a Page template.
    The other is used by WP to display your monthly and category archives when clicking on a month name or cat name.
    See the difference on my dev. blog:
    monthly archive (WP automatically uses the archive.php)
    http://www.transycan.net/blogtest/2005/06/
    Archives Page (created using the archives.php Page template)
    http://www.transycan.net/blogtest/?page_id=4

    BTW, never link directly to any of the template files!

  14. TonyGeer
    Member
    Posted 8 years ago #

    Man, I didnt realise that it was for archiveS.php. Either way, that plugin has proven to be immensly useful for me too. I would have eventually gone looking for something to do that exact thing.

    Kafk, thank you for the link! That's exactly what I was looking for. I used

    query_posts('posts_per_page=10');

    Then ran the loop and it was exactly what I needed.

    Thanks a lot for the help everyone, it was highly appreciated! Im always impressed with the wordpress community.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.