分页在类别.php中不起作用

时间:2017-06-13 作者:user1614141

类别页面上的分页不起作用。

我使用一个名为“Bridge”的主题,永久链接设置为“/blog/%category%/%postname%/”。

我的分类页面位于以下url中:http://ikontrol.dk/da/blog/nyheder/如果我使用底部的分页,我会得到以下url:da/blog/nyheder/page/2/I give-self和404-page-not-found。

如果我手动将url更改为:da/blog/nyheder/?page=2已选择第2页,但内容仍为第1页。

正如我在小说中看到的那样。php,它调用“get\\u template\\u part(\'templates/blog\',\'structure\')

<?php 
    global $wp_query;
    global $qode_options_proya;
    global $qode_template_name;
    $id = $wp_query->get_queried_object_id();

    if ( get_query_var(\'paged\') ) { $paged = get_query_var(\'paged\'); }
    elseif ( get_query_var(\'page\') ) { $paged = get_query_var(\'page\'); }
    else { $paged = 1; }

    if(isset($qode_options_proya[\'blog_page_range\']) && $qode_options_proya[\'blog_page_range\'] != ""){
        $blog_page_range = $qode_options_proya[\'blog_page_range\'];
    } else{
        $blog_page_range = $wp_query->max_num_pages;
    }

    $filter = "no";
    if(isset($qode_options_proya[\'blog_masonry_filter\'])){
        $filter = $qode_options_proya[\'blog_masonry_filter\'];
    }

    $blog_style = "1";
    if(isset($qode_options_proya[\'blog_style\'])){
        $blog_style = $qode_options_proya[\'blog_style\'];
    }

    $blog_list = "";
    if($qode_template_name != "") {
        if($qode_template_name == "blog-large-image.php"){
            $blog_list = "blog_large_image";
            $blog_list_class = "blog_large_image";
        }elseif($qode_template_name == "blog-masonry.php") {
            $blog_list = "blog_masonry";
            $blog_list_class = "masonry";
        }elseif($qode_template_name == "blog-masonry-gallery.php"){
            $blog_list = "blog_masonry_gallery";
            $blog_list_class = "masonry_gallery";
        }elseif($qode_template_name == "blog-masonry-full-width.php"){
            $blog_list = "blog_masonry";    
            $blog_list_class = "masonry_full_width";                
        }elseif($qode_template_name == "blog-masonry-date-in-image.php"){
            $blog_list = "blog_masonry_date_in_image";
            $blog_list_class = "masonry blog_masonry_date_in_image";
        }elseif($qode_template_name == "blog-masonry-full-width-date-in-image.php"){
            $blog_list = "blog_masonry_date_in_image";
            $blog_list_class = "masonry_full_width blog_masonry_date_in_image";
        }elseif($qode_template_name == "blog-large-image-whole-post.php"){
            $blog_list = "blog_large_image_whole_post"; 
            $blog_list_class = "blog_large_image";  
        }elseif($qode_template_name == "blog-small-image.php"){
            $blog_list = "blog_small_image";
            $blog_list_class = "blog_small_image";
        }elseif($qode_template_name == "blog-large-image-simple.php"){
            $blog_list = "blog_large_image_simple";
            $blog_list_class = "blog_large_image_simple";
        }elseif($qode_template_name == "blog-large-image-with-dividers.php"){
            $blog_list = "blog_large_image_with_dividers";
            $blog_list_class = "blog_large_image_with_dividers";
        }else{
            $blog_list = "blog_large_image";
            $blog_list_class = "blog_large_image";
        }
    } else{
        if($blog_style=="1"){
            $blog_list = "blog_large_image";
            $blog_list_class = "blog_large_image";
        }elseif($blog_style=="2"){
            $blog_list = "blog_masonry";    
            $blog_list_class = "masonry";   
        }elseif($blog_style=="5"){
            $blog_list = "blog_masonry";    
            $blog_list_class = "masonry_full_width";
        }elseif($blog_style=="3"){
            $blog_list = "blog_large_image_whole_post"; 
            $blog_list_class = "blog_large_image";  
        }elseif($blog_style=="4"){
            $blog_list = "blog_small_image";
            $blog_list_class = "blog_small_image";
        }elseif($blog_style=="6"){
            $blog_list = "blog_large_image_simple";
            $blog_list_class = "blog_large_image_simple";
        }elseif($blog_style=="7"){
            $blog_list = "blog_large_image_with_dividers";
            $blog_list_class = "blog_large_image_with_dividers";
        }elseif($blog_style=="8"){
            $blog_list = "blog_masonry_date_in_image";
            $blog_list_class = "masonry blog_masonry_date_in_image";
        }else {
            $blog_list = "blog_large_image";
            $blog_list_class = "blog_large_image";
        }
    }

    $pagination_masonry = "pagination";
    if(isset($qode_options_proya[\'pagination_masonry\'])){
       $pagination_masonry = $qode_options_proya[\'pagination_masonry\'];
        if(in_array($blog_list, array(\'blog_masonry\',\'blog_masonry_date_in_image\',\'blog_masonry_gallery\'))) {
            $blog_list_class .= " masonry_" . $pagination_masonry;
        }
    }
?>
<?php 
    if(($blog_list == "blog_masonry" || $blog_list == "blog_masonry_date_in_image") && $filter == "yes") { 
        get_template_part(\'templates/masonry\', \'filter\');
    }
?>
<div class="blog_holder <?php echo $blog_list_class; ?>">
    <?php
    if(in_array($blog_list, array(\'blog_masonry\',\'blog_masonry_date_in_image\',\'blog_masonry_gallery\'))){ ?>
        <div class="blog_holder_grid_sizer"></div>
        <div class="blog_holder_grid_gutter"></div>
    <?php } ?>
    <?php if(have_posts()) : while ( have_posts() ) : the_post(); ?>
        <?php 
            get_template_part(\'templates/\'.$blog_list, \'loop\');
        ?>
    <?php endwhile; ?>
    <?php if($blog_list != "blog_masonry" && $blog_list != "blog_masonry_date_in_image" && $blog_list != "blog_masonry_gallery") { ?>
        <?php if(isset($qode_options_proya[\'pagination\']) && $qode_options_proya[\'pagination\'] != "0") : ?>
            <?php pagination($wp_query->max_num_pages, $blog_page_range, $paged); ?>
        <?php endif; ?>
    <?php } ?>
    <?php else: //If no posts are present ?>
    <div class="entry">                        
            <p><?php _e(\'No posts were found.\', \'qode\'); ?></p>    
    </div>
    <?php endif; ?>
</div>
<?php if(in_array($blog_list, array(\'blog_masonry\',\'blog_masonry_date_in_image\',\'blog_masonry_gallery\'))) {
    if($pagination_masonry == "load_more") { 
        if (get_next_posts_link()) { ?>
            <div class="blog_load_more_button_holder">
                <div class="blog_load_more_button"><span rel="<?php echo $wp_query->max_num_pages; ?>"><?php echo get_next_posts_link(__(\'Show more\', \'qode\')); ?></span></div>
                <div class="blog_load_more_button_loading"><a href="javascript: void(0)" class="qbutton"><?php _e(\'Loading...\', \'qode\'); ?></a></div>
            </div>
        <?php } ?>
     <?php } elseif($pagination_masonry == "infinite_scroll") { ?>
        <div class="blog_infinite_scroll_button"><span rel="<?php echo $wp_query->max_num_pages; ?>"><?php echo get_next_posts_link(__(\'Show more\', \'qode\')); ?></span></div>
    <?php }else { ?>
        <?php if($qode_options_proya[\'pagination\'] != "0") : ?>
            <?php pagination($wp_query->max_num_pages, $blog_page_range, $paged); ?>
        <?php endif; ?>
    <?php } ?>
<?php } ?>
有人能帮我吗?

1 个回复
SO网友:Kamlesh DjKammu

将下面的代码置于HTML之前

$qode_options_proya[\'pagination\'] = 1;

结束

相关推荐

wp_list_categories + widget

使用下面的代码,我添加了一个span标记,并将类别计数放置在链接中。add_filter(\'wp_list_categories\', \'cat_count_span\'); function cat_count_span($links) { $links = str_replace(\'</a> (\', \'<span>\', $links); $links = str_replace(\')\', \'<