admin管理员组

文章数量:1391795

Why does next_posts(); function does not work inside header.php whereas it ^does work^ inside temlate-homepage.php ? My code below:

<?php

// Query ALL posts ordered by random

$args = array(

'post_type' => array('projekt'), // Posts

'orderby' => 'rand', // Order random

'posts_per_page' => 8, // get all posts

'ignore_sticky_posts' => true, // Do not preserve order of stickies

);

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$the_query = new WP_Query( $args );

echo next_posts();

?>

....even when I add a parameter like 'max_num_pages' to next_posts(); function -> it does not work in ^header.php^

...it seems like get_header(); command has something to do with it, because when I paste the whole header.php code inside template-homepage.php then next_posts() works properly which means if I'm on /page/3/ -> next_posts() will return /page/4/ url...

本文标签: paginationWhy nextposts() function does not work inside headerphp