Reputation: 171
I am trying to get the page number from the URL "http://www.someurl.com/?alpha=A/page/2", but it keeps printing out "0", not "2". Please help.
$current_page = get_query_var('paged');
echo "current page is $current_page";
Upvotes: 0
Views: 481
Reputation: 5028
If I understood you question, you want to get number 2 from http://www.someurl.com/?alpha=A/page/2
string.
You could use some php
string manipulation functions:
$curr_link = "http://www.someurl.com/?alpha=A/page/2";
$page_num = substr($curr_link, -1, 1);
Upvotes: 1
Reputation: 420
This should echo "Page 2 of 2" See: wordpress pagination get current page number from url
<?php echo '(Page '.$page.' of '.$numpages.')'; ?>
Upvotes: 1