Home>Support>Post Loop – show latest 2 posts only

Post Loop – show latest 2 posts only

I am trying to get the post loop widget to show just the latest 2 posts from a category

I have

post type – posts
posts per page 2
and in additional

cat=3&max_num_pages=1

The cat=3 works (takes just posts from this category), but still shows pages – how do I stop pagination appearing?

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 7 years, 11 months ago Alex S
    Hi, I Work Here

    Hi Robin,

    max_num_pages is a property of WP_Query and isn’t used to limit the number of results – it’s actually to work out how many pages are present. What you would normally do to do this is set a posts per page and then never actually display the pagination.

    In other words, it’s up to your template to not show the pagination. If your template doesn’t include another template that doesn’t include pagination, the most you can do (outside of creating a new template – which I sadly can’t help with) would be to hide the pagination on that page. I can help with that – do you have a public URL where we can take a look at what’s going on? If you need to keep this URL private from other users, just select “Private Reply” on the bottom right of the comment box.

  2. 7 years, 11 months ago Robin Wilson

    Alex,

    Thanks for this – I’ll do work on the template

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More