Set number of article per number of page

Pagination is result of combining two factors: page size and offset. In common case page size is constant and offset is page size times current page.

Is it possible to build highly elaborate pagination you describe? Technically yes. That would be matter to adjusting page size and offset in a more elaborate fashion.

However specific of such implementation would be highly inconvenient. Imagine you are on a page 15. How do you determine which month it is? You would need to backtrack all the way to the start and rebuild page by page 14 previous pages to get a clue at which point are you. Note that very likely not all months will have posts, even if that’s the case right now.

What could you do instead? Use date archives. WP is perfectly capable of producing pages which hold time–based archive for the specific month (e.g. example.com/2016/06/) out of the box.

On any specific month you know exactly at which point in time you are, the rest is just matter of providing UI/links to other months, instead of typical pagination (for example with wp_get_archives()).

Leave a Comment