Php wordpress pagenation导航链接重定向到自定义帖子类型模板中的404

Php wordpress pagenation导航链接重定向到自定义帖子类型模板中的404,php,wordpress,Php,Wordpress,转到管理面板仪表板 转到设置>>永久链接 更新你的永久链接 尝试更新permalink一次并检查事实上我是wordpress新手,请告诉我permalinks的设置应该做什么。只需转到您的仪表板-->设置-->permalinks并点击保存,感谢您的回复…但是有3个部分可以更新permalinks,更新哪一个以及如何更新请提供一些信息我做了,但没有帮助,仍然有同样的问题。将我重定向到localhost/blog/page/2,但显示404错误。您的上述代码是正确的。只需做一件事,将permali

转到管理面板仪表板

  • 转到设置>>永久链接

  • 更新你的永久链接


  • 尝试更新permalink一次并检查事实上我是wordpress新手,请告诉我permalinks的设置应该做什么。只需转到您的
    仪表板-->设置-->permalinks
    并点击
    保存
    ,感谢您的回复…但是有3个部分可以更新permalinks,更新哪一个以及如何更新请提供一些信息我做了,但没有帮助,仍然有同样的问题。将我重定向到localhost/blog/page/2,但显示404错误。您的上述代码是正确的。只需做一件事,将permalink更新为默认值,然后检查onceThanks,非常感谢您……它工作正常,节省了我的时间。但是默认的permalink设置会破坏我网站的url结构,这意味着它应该是“localhost/mysite.com/blog”,但它就像“请建议我使用它,或者我可以从.htaccess文件中使用它”?。再次感谢您。是的,您设置了htaccess吗?。如果有帮助,请勾选正确以接受答案。
         <?php
    /*
    Template Name: All Blog Post Custom Template
    */
    ?>
    <?php
    /**`enter code here`
     * @author madars.bitenieks
     * @copyright 2013
     */
    ini_set('display_error',1);
    get_header(); 
    $page_idd = get_the_ID();
    global $post;
    //print_r($_GET);exit;
    $mt_comment=get_post_meta($post->ID, "madza_comment", true); 
    $mt_layout = get_post_meta($post->ID, "layout_positions", true);
    
    $mt_float_layout = "";
    $mt_float_sidebar = "";
    
    if ($mt_layout == "left") {
    
        $mt_float_layout = "floatright";
        $mt_float_sidebar = "floatleft";
    }
    
    $more = 0;
    
    ?>
    
    <div class="row">
    
        <div class="span<?php if ($mt_layout != "full") { echo "8 "; } else {  echo "12 "; } echo $mt_float_layout; ?> ">
    
                <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
                        <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
                                <?php the_content( __( '<div class="reed_more">Reed More &raquo;</div><div></div>', 'madza_translate' ) ); ?>
    
                               <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'madza_translate' ), 'after' => '</div>' ) ); ?>
    
                               <div class="clear"></div>
    
                        </div><!--END POST -->
    
                        <?php if($mt_comment=='Yes'){ comments_template( '', true );  }?>
    
                    <?php endwhile; wp_reset_query();  ?>
    
        </div>
                                                                <!-- code for showing all blog post -->
            <div class="rpwe-block" style="">
                <ul class="rpwe-ul">
                    <?php 
                    $the_query = new WP_Query($args);
                    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                    set_query_var('page',$paged);
                    $the_query = new WP_Query( array(
                    'post_type' => 'blog',
                    'posts_per_page' => 2,
                    'orderby'=> 'menu_order',
                    'paged' => $paged
                    ) );
                    ?>
                    <?php if ($the_query->have_posts()) : ?>
                        <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
                            <li class="rpwe-clearfix"> 
                                <a href="<?php the_permalink() ?>">
                                    <?php
                                    add_image_size('custom-size', 180, 150);
                                    the_post_thumbnail('thumbnail');
                                    ?>
                                    <h3 class="rpwe-title"><?php the_title(); ?></h3>
                                </a>
                                <span class="rpwe-time published"><?php echo get_the_date(); ?></span>                                                              
                                <div class="rpwe-summary">
                                    <?php echo substr(get_the_content(), 0, 100) . "..."; ?>
                                    <a href="<?php the_permalink() ?>"><p>Read More</p></a>
                                </div> 
                            <?php
                        endwhile;
                        ?>
                            <div class="nav-previous alignleft"><?php previous_posts_link('&laquo; Newer posts');?></div>
                            <div class="nav-next alignright"><?php next_posts_link( 'Older posts &raquo;', $the_query->max_num_pages ); ?></div>
                            <?php wp_reset_postdata(); ?>
                <?php   else :
                        ?>
                        <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
                    <?php endif; ?>       
                </ul>
    
            </div>
    
    
        <?php if ($mt_layout != "full") { ?>
    
            <div class="span4 <?php echo $mt_float_sidebar; ?> "><?php if( !($page_idd == 17169 or $page_idd == 17170) ){get_sidebar();} ?></div>
    
        <?php } ?>
    
    </div>
    
    <?php get_footer(); ?>