Answer the question
In order to leave comments, you need to log in
Why is get_query_var('page') not returning anything?
There is a blog page - static. I'm trying to set up pagination, but when I go through the pages, the same posts are displayed.
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
Answer the question
In order to leave comments, you need to log in
In general, I made a crutch suitable for myself. The site is simple overall. Just for paged, I isolated the page number from the address bar and assign it to paged. Who knows, let him say what problems can arise?
$paged = 1;
$req_uri = array_reverse(explode('/', $_SERVER['REQUEST_URI']));
foreach ($req_uri as $value) {
if(is_numeric($value)) {
$paged = $value;
break;
}
}
$args = array (
'post_type' => 'post',
'post_status' => array( 'publish' ),
'posts_per_page' => '8',
'paged' => $paged
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question