Forums

[resolved] Page number string? (4 posts)

  1. Jenst
    Member
    Posted 4 years ago #

    When the permalinks are set, the url could be something like this...

    /about/page/5/

    I'm writing a plugin and I need to get the page number, as a string (or alike).

    I could use server variables and explode it but if there are a change in the permalink structure I would get an error. Is there a way to get this page number?

  2. Jenst
    Member
    Posted 4 years ago #

    Found it finally! The string is called $paged and the code you need is...

    global $paged;
    echo $paged;

  3. capzman
    Member
    Posted 3 years ago #

    this doesn't work on version 2.6.x isn't it?

  4. capzman
    Member
    Posted 3 years ago #

    use this on page 2.6.x
    global $page;
    echo 'page:'.$page;

Topic Closed

This topic has been closed to new replies.

About this Topic