wp13410 on "Previous page not working for blog in homepage"

خرید بک لینک

Hi,
since I've moved my blog page in homepage, the "previous" link doesn't work any more: it just link again to the home page (even if the url changes to "...websiteurl/page/2").
However, if I choose a category, then it works fine. But still not working with the general all posts query.

I've read many old solutions but they just didn't work for me.
I think that the trick should be in linking the "...websiteurl/blog/page/2" (like I can see "...websiteurl/category/categoryname/page/2" for category, and it works) but I don't know how to do it.
I can program but I'm not a php (or wordpress) expert.

Here is my blog.php code:

<?php
/**
 * Blog Template
 *
 * Template Name: Blog Posts
 *
 * @file           blog.php
 * @package        Pilot Fish
 * @filesource     wp-content/themes/pilot-fish/blog.php
 * @since          Pilot Fish 0.1
 */
get_header(); ?>

<?php global $more; $more = 0; ?>
        <div id="content" class="row span8" role="main">
<?php
    $limit = get_option('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=' . $limit . '&paged=' . $paged);
    $wp_query->is_archive = true; $wp_query->is_home = false;
    ?>
<?php if (have_posts()) : ?>
                <?php while (have_posts()) : the_post();
                if( !get_post_format() ) {
                                        get_template_part( 'content', 'standard' );
                                } else {
                                        get_template_part( 'content', get_post_format() );
                                }
                                Idea_template( '', true ); ?>
        <?php endwhile; ?> 

        <?php if ($wp_query->max_num_pages > 1) { ?>
                  <nav id="post-nav" class="pager">
                    <div class="previous"><?php next_posts_link(__('&larr; previous', 'pilotfish')); ?></div>
                    <div class="next"><?php previous_posts_link(__('next &rarr;', 'pilotfish')); ?></div>
                        <!--<?php posts_nav_link('separator','prelabel','nextlabel'); ?>-->

                  </nav>
                <?php } ?>
<?php endif; ?>
        </div><!-- end of #content-blog -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Thank you for the help!

WordPress ...

ما را در سایت WordPress دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 299 تاريخ: دوشنبه 11 مرداد 1395 ساعت: 18:45

صفحه بندی