• I have a static home page and a different posts page.

    I want to make my posts page the home page. When I do that everything works fine except for the “next page” function.

    When you click next page it takes you to “www.mydomain.com/page/2” but still shows the posts from page 1.

    It works fine when the url is “www.mydomain.com/blog/page/2”

    How can I redirect the next page function to include “blog” in the url so that it functions correctly as the home page or make it so that it doesn’t need “blog” in the url and functions normally with just “page/2” etc.

    Thanks in advance for the help!

Viewing 9 replies - 1 through 9 (of 9 total)
  • are you using custom query function like query_posts or WP_Query()? After the while loop put this function wp_reset_query()

    Thread Starter Inspireddrum

    (@inspireddrum)

    Here’s what the posts page looks like. I see the WP_Query function but don’t know where to put the reset. There’s also a WP_pagenavi query at the bottom but I don’t think that’s affecting it.

    <div id="blog_content">
            <?
                $args = array(
                    'post_type' => 'post',
                    'posts_per_page' => 5,
                    'paged' =>  $paged
                );
                $the_query = new WP_Query( $args );
                while ( $the_query->have_posts() ) : $the_query->the_post();
            ?>
                <div class="blog_post">
                    <? if ( has_post_thumbnail() ) : ?>
                        <a href="<? the_permalink(); ?>">
                            <?
                                the_post_thumbnail('sm_thumb',
                                    array(
                                        'class' => 'excerpt_thumb'
                                    )
                                );
                            ?>
                        </a>
                    <? else: ?>
                        <a href="<? the_permalink(); ?>"><img class="excerpt_thumb" src="<? bloginfo('template_url'); ?>/img/default_post_thumb.jpg"></a>
                    <? endif; ?>
                    <div class="post_block">
                        <h1 class="font"><a href="<? the_permalink(); ?>"><? the_title(); ?></a></h1>
                        <div class="meta">by <? echo get_the_author(); ?> on <? echo get_the_date(); ?> in <ul class="excerpt_cats"><? echo get_the_category_list(); ?></ul></div>
                        <? the_excerpt(); ?>
                    </div>
                </div>
            <?
                endwhile;
                wp_pagenavi(array(
                    'query' => $the_query
                ));
                wp_reset_postdata();
            ?>
        </div>

    <?
    endwhile;
    wp_pagenavi(array(
    ‘query’ => $the_query
    ));
    wp_reset_postdata();
    ?>

    will be

    <?
    endwhile;
    wp_reset_query();
    wp_pagenavi();

    ?>

    Try once this

    Thread Starter Inspireddrum

    (@inspireddrum)

    That just removed the page navigation at the bottom of the page.

    try to replace:

    'paged' =>  $paged

    with:

    'paged' =>  get_query_var('paged')

    Thread Starter Inspireddrum

    (@inspireddrum)

    Just tried what you suggested alchymyth and the same thing is still happening. Any other ideas?

    <div id="blog_content">
            <?// Fix for the WordPress 3.0 "paged" bug.
    $paged = 1;
    if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); }
    if ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); }
    $paged = intval( $paged );
     $args = array(
                    'post_type' => 'post',
                    'posts_per_page' => 5,
                    'paged' =>  $paged
                );
                $the_query = new WP_Query( $args );
                while ( $the_query->have_posts() ) : $the_query->the_post();
            ?>
                <div class="blog_post">
                    <? if ( has_post_thumbnail() ) : ?>
                        <a href="<? the_permalink(); ?>">
                            <?
                                the_post_thumbnail('sm_thumb',
                                    array(
                                        'class' => 'excerpt_thumb'
                                    )
                                );
                            ?>
                        </a>
                    <? else: ?>
                        <a href="<? the_permalink(); ?>"><img class="excerpt_thumb" src="<? bloginfo('template_url'); ?>/img/default_post_thumb.jpg"></a>
                    <? endif; ?>
                    <div class="post_block">
                        <h1 class="font"><a href="<? the_permalink(); ?>"><? the_title(); ?></a></h1>
                        <div class="meta">by <? echo get_the_author(); ?> on <? echo get_the_date(); ?> in <ul class="excerpt_cats"><? echo get_the_category_list(); ?></ul></div>
                        <? the_excerpt(); ?>
                    </div>
                </div>
            <?
                endwhile;
                wp_pagenavi();
                wp_reset_query();
            ?>
        </div>
    Thread Starter Inspireddrum

    (@inspireddrum)

    THANKS WPROCK! That worked! 🙂

    welcome

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Making Next Page Work’ is closed to new replies.