Limit number of posts shown in each category

Discussion in 'WordPress' started by Matt18, Feb 6, 2012.

  1. #1
    Hi

    I am using...

    if(have_posts())
    {
    Code (markup):
    ... on my category template. I show 10 posts per page. I currently have 500+ posts in all categories.

    I would like to limit number of posts shown. I would like to keep 10 posts per page but only show first 100 posts or with other words first 10 pages with 10 posts on each page.

    How could I change the query to do that?

    Thank you very much for your help!

    All the best.
     
    Matt18, Feb 6, 2012 IP
  2. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Try this:
    http://wordpress.org/extend/plugins/custom-post-limits/
     
    hmansfield, Feb 6, 2012 IP
  3. Matt18

    Matt18 Guest

    Messages:
    591
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you, but this is per page setting. I need total number of posts limit or with other words, to show only first 10 pages with 10 posts on each page.

    Please, anyone?
     
    Matt18, Feb 6, 2012 IP
  4. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #4
    Seems like you are concentrating on trying to limit the pages, instead of attacking it from the other way, limiting the number of posts.

    If you limit the number of posts to 100, and you have it set to show 10 per page, that would be 10 pages. Right?
    You may have to create new page templates for each category and set the limit for each one,
    Something like this (not actual code, just the idea) :
    I think you answer, or at least the direction you want to go is here:
    http://codex.wordpress.org/Function_Reference/query_posts
     
    hmansfield, Feb 7, 2012 IP
  5. Matt18

    Matt18 Guest

    Messages:
    591
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ok, so I'll be limiting the number of pages shown somehow... Where is this caluculated?

    I guess it has something to do with $max_num_pages variable in query.php, but it is set to 0 there and I can't find where it is changed... can you please help me out?

    thanks!
     
    Matt18, Feb 13, 2012 IP
  6. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #6
    No. Limit the number of posts. It's just basic math. If you already have it set to show 10 post per page, then limit the number of posts to 100 posts.
    Aren't you getting the math part of this?
    You are making it harder than it has to be.
     
    hmansfield, Feb 13, 2012 IP