Pagination &引用;“破碎的”;标页码

Pagination &引用;“破碎的”;标页码,pagination,http-status-code-404,wordpress,Pagination,Http Status Code 404,Wordpress,在我的WordPress网站上,我有一个自定义帖子类型的分页。当我说工作时,我的意思是分页正在出现。例如,每当我试图转到第2页时,就会出现404错误。我有一个非常类似的代码片段,在博客帖子上运行得非常好。有什么建议吗?代码如下: <?php /** * @package WordPress * @subpackage themename * Template Name: Resources Template */ get_header(); ?> <div i

在我的WordPress网站上,我有一个自定义帖子类型的分页。当我说工作时,我的意思是分页正在出现。例如,每当我试图转到第2页时,就会出现404错误。我有一个非常类似的代码片段,在博客帖子上运行得非常好。有什么建议吗?代码如下:

    <?php
/**
 * @package WordPress
 * @subpackage themename
 * Template Name: Resources Template
 */

get_header(); ?>
<div id="main">
        <div id="primary">
            <div id="content">

                <?php the_post(); ?>

                <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> role="article">

                        <h1 class="entry-title"><?php the_title(); ?></h1>

                    <div class="entry-content">
                        <?php the_content(); ?>
                        <?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array( 'post_type' => 'cbd_resources', 'posts_per_page' => 5, 'paged' => $paged); // -1 Shows ALL Posts
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>

                        <?php
$resourceURL = get_post_meta($post->ID,'resourceURL',true);
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail_name');
$imgURL = (isset($thumb[0]) ? $thumb[0] : get_template_directory_uri() . "/images/placeholder.jpg"); ?>


                        <div class="testimonialListing">
                            <img src="<?php echo get_template_directory_uri(); ?>/thumb.php?src=<?php echo urlencode($imgURL); ?>&w=127&zc=2">
                            <div class="testimonialInfo">
                                <span><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></span>
                                <?php the_content(); ?>
                                <strong><a href="<?php the_permalink(); ?>">READ MORE</a></strong>
                            </div>
                        </div>

                        <?php endwhile; ?>


                    <?php wp_reset_query(); ?>
                        <div class="pagination">
                        <?php $total_pages = $loop->max_num_pages;

if ($total_pages > 1){

    $current_page = max(1, get_query_var('paged'));

    echo paginate_links(array(
            'base' => get_pagenum_link(1) . '%_%',
            'format' => '/page/%#%',
            'current' => $current_page,
            'total' => $total_pages,
        ));
}   ?>
                        </div>
                                            </div><!-- .entry-content -->
                </article><!-- #post-<?php the_ID(); ?> -->



            </div><!-- #content -->
            <div id="secondary" class="widget-area"><?php if ( dynamic_sidebar('resources-sidebar') ) : else : ?><?php endif; ?></div>
        </div><!-- #primary -->


<?php get_footer(); ?>


建议:在中进行研究。这个问题已经被问过/回答过很多次了。