Index + Pagination : counting pages (3 posts)

  1. Dunkkan
    Posted 7 years ago #

    Hi guys,

    I'd like to print something like this in the Index Page (while the user is browsing the several pages of 'old posts' from the Index ):

    "you are in Page 2 of 25 pages" ?

    Or "you are in Page 2/25" ?

    I can count the total number of posts but I'm lost here :)
    Many thanks for any input.

  2. esmi
    Forum Moderator
    Posted 7 years ago #

    Could you retrieve the number of posts per page using get_option. Something like ceil(total number of posts / posts per page) should give you the total number of pages.

  3. Dunkkan
    Posted 7 years ago #

    Hi esmi, thanks for the info.

    But how would you apply the ceil function once you have the number of posts ? I'm just not familiar enough with PHP.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.