WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page 2,3 etc.. in blog redirecting to homepage (7 posts)

  1. miralize
    Member
    Posted 4 years ago #

    Hey guys, I'm running the RC3 of WordPress and I dunno when it started but whenever I go to http://miralize.com/blog/page/2/ it goes to the homepage instead of the second page of blog posts.

    I have home as my static page and a blog page for my blog posts. Any help would be greatly appreciated.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Does your index.php file use a custom query? If so, you need to modify it to include the paged variable - eg:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'category_name' => 'News',
    	'paged' => $paged
    );
    query_posts($args);
    ?>
  3. miralize
    Member
    Posted 4 years ago #

    Aghh thanks. Yep it is, I'm pulling in blog posts and thumbnails. Cheers for that :)

  4. miralize
    Member
    Posted 4 years ago #

    Sorry it isnt. It only has the regular

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    
    <?php endwhile; else :  endif; ?>

    i thought you were talking about my homepage.php page.

  5. esmi
    Forum Moderator
    Posted 4 years ago #

    Your blog page should be using the theme's index.php template file. I've just checked your Blog page and the page 2, 3 etc seem to be working.

  6. miralize
    Member
    Posted 4 years ago #

    Yeah I fixed it. It was a problem with a function. I was excluding a portfolio category , but now that wp3 is out I moved to custom post types and I removed the function to exclude the category.

    Thanks anyway.

  7. louissoriano
    Member
    Posted 4 years ago #

    I actually have the same problem. The next page (next_post_link) is redirecting me to index.php template. Can you explain further in specific how u are able to solve the problem? Sorry I'm new to wordpress and can't quite understand your solution to the problem. Below is the code I use

    <?php
    
    							$wp_query = new WP_Query();
    
    							$wp_query->query('category_name=nail-salon&showposts=1&order=ASC'.'&paged='.$paged);
    						?>
    
                            <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
                            <?php the_content(); ?>
    
                           		<div style="clear:right;"></div>
    
                            	<br /><br />
    
      							<div class="float-right" style="margin-left:10px;"><p><?php next_posts_link('More &raquo;') ?></p></div>
                                <div class="float-right"><p><?php previous_posts_link('&laquo; Previous') ?></p></div>
    
                            <?php endwhile;?>

Topic Closed

This topic has been closed to new replies.

About this Topic