• Resolved ansel51

    (@ansel51)


    If you have the permalink and know what category a post is in, is there a simple way to get the page number (in my case there are one post per page). By page number I’m talking about something that looks like this:
    `
    [site name]/category/category_name/page/n where n would be the page number.

    Can this be done without running an extra query?

    Thanks in advance, and hope this is clear.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Can use the query_var ‘paged’:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    Thread Starter ansel51

    (@ansel51)

    THANK YOU! I hoped there was a var out there somewhere but couldn’t find it.

    Dave

    This in a template can be handy in ‘finding’ those vars:

    <?php
    echo "<pre>"; print_r($wp_query->query_vars); echo "</pre>";
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get page number in category from permalink’ is closed to new replies.