将永久链接结构更改为postname后的wordpress分页

时间:2014-06-09 09:28:24

标签: php wordpress

更改为任何固定链接结构后,每当我在博客上更改页面时,都会收到“找不到页面”。这是我的代码:

<div id="content" class="site-content" role="main">
            <?php
                global $paged;
                $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                $args = array (
                    'post_type' => 'blog',
                    'status' => 'published',
                    'posts_per_page' => 4,
                    'paged' => $paged,
                    'orderby' => 'desc',
                    );
                $blogPosts = new WP_Query($args);

                while($blogPosts->have_posts()): $blogPosts->the_post(); ?>
                    <div id="blog-post-<?php echo the_ID(); ?>">
                        <a href="<?php echo the_permalink(); ?>">
                            <div id="blog-header">
                                <h5><?php echo the_title(); ?></h5>
                                <strong>-<?php echo the_author(); ?></strong>
                            </div>
                        </a>
                        <div id="blog-content">
                            <p id="content-<?php echo the_ID(); ?>">
                                <?php echo the_content(); ?>
                            </p>
                        </div>
                    </div>
                <?php endwhile;?>
            <!-- **Pagination** -->
            <div class="pagination">
            <?
                $next = get_next_posts_link('<span>Older Posts</span>', $blogPosts->max_num_pages);
                $prev = get_previous_posts_link('<span>Newer Posts</span>');
            ?>
                <div class="prev-post">                     
                    <?php echo $prev; ?> 
                </div>           
                <div class="next-post"> 
                    <?php echo $next;?>                 
                </div>enter code here
            </div><!-- **Pagination - End** --> 
        </div><!-- #content -->

我需要这个工作到任何名称永久链接结构。提前谢谢!

0 个答案:

没有答案