admin管理员组文章数量:1327690
I have a static home page on my Wordpress blog and I cannot seem to figure this out.
I want to be able to navigate between different pages in my blog via the pagination.
I changed 'paged' to 'page' as I have seen that you should use 'page' for static home pages.
However, when I click page 2 or 3, the page reloads and refreshes the home page. It doesn't go to the next page like I need it to.
This was already built into the theme, but for some reason it just won't work.
Any help is greatly appreciated!
/**
* Set the "paged" parameter (use 'page' if the query is on a static front page).
*
* @var int $paged
*/
'<?php
$mb_theme_options = maicha_blog_theme_options();
$mid_post_category = $mb_theme_options['mid_post_category'];
$story_layout = $mb_theme_options['story_layout'];
$sidebar_position = $mb_theme_options['sidebar_option'];
$mid_post_title = $mb_theme_options['mid_post_title'];
$mid_checkbox = $mb_theme_options['mid_checkbox'];
$mid_post_break = $mb_theme_options['mid_post_break'];
if (is_page_template('page-templates/homepage.php') && $mid_checkbox== '1'){
if($mid_post_category && 'none' != $mid_post_category){
$paged = get_query_var( 'page' ) ? intval( get_query_var( 'page' ) ) : 1;
$args = array(
'post_type' => 'post',
'posts_per_page' => $mid_post_break,
'post_status' => 'publish',
'order' => 'desc',
'page' => $paged,
'orderby' => 'menu_order date',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array( $mid_post_category ),
),
),
);
}
else{
$args = array(
'post_type' => 'post',
'posts_per_page' => 5,
'post_status' => 'publish',
'order' => 'desc',
'orderby' => 'menu_order date',
);
}
$total_pages = $featured->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('page'));
echo '<div class="navigation">';
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => '?page=%#%',
'current' => $current_page,
'total' => $total_pages,
'type' => 'list',
'prev_text' => esc_html__('Previous Posts','maicha-blog'),
'next_text' => esc_html__('More Posts','maicha-blog'),
));
echo '</div>';
}
wp_reset_postdata();
}
?>'
本文标签: phpstatic page pagination not working
版权声明:本文标题:php - static page pagination not working 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742220150a2435300.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论