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
版权声明:本文标题:pagination - Why next_posts(); function does not work inside header.php? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744766534a2624075.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论