• Resolved ftrabbold

    (@ftrabbold)


    I have a problem with the pagination on my blog:
    https://www.thaismarostica.com.br/site/

    What happens is that when you click on “next page” on the button in the bottom of the page, it loads the same content of the first page.

    It is running on a subcategory folder. Maybe that’s a problem with my permanent links, it is set on “postname”.

    Please guys, I have tried everythinh!

Viewing 3 replies - 1 through 3 (of 3 total)
  • I just solved this problem for myself. are you using

    query_posts();

    ?

    Cause if you are, you need to realize that you are altering the main loop and have reset the global query.

    here is my code example

    global $wp_query;
    	query_posts(array_merge(array(
    	     'category_name' => 'news-events',
    	     'orderby' => 'date',
    	     'order' => 'DESC',
    	     'posts_per_page' => 5
    	     ),$wp_query->query));
    Thread Starter ftrabbold

    (@ftrabbold)

    In the fact I can’t say. Where do I find it? On index.php?

    If yes, here is my index.php code, there is query_posts();
    but it’s from an theme I bought, I really don’t know how to change it:

    <?php get_header(); ?>
    <?php dynamic_sidebar("slider"); ?>
    <?php if(get_option("ocmx_home_page_layout") == "widget") :
    	if (function_exists('dynamic_sidebar') && is_active_sidebar("widget1")) : ?>
    	<div id="widget-block" class="clearfix">
    		<ul class="widget-list clearfix">
    			<?php dynamic_sidebar("widget1"); ?>
    		</ul>
    	</div>
    	<?php endif;
    else :
    	if(get_option("ocmx_home_page_categories") && get_option("ocmx_home_page_categories") !== 0):
    		$use_catid = get_option("ocmx_home_page_categories");
    		$fetch_category = get_category_by_slug($use_catid);
    		$use_category = "cat=".$fetch_category->term_id."&";
    	else :
    		$use_category = "";
    	endif;
    	if (is_paged()) :
    		query_posts($use_category ."showposts=".get_option("ocmx_home_page_posts")."&paged=".get_query_var('paged'));
    	elseif (is_home()) :
    		query_posts($use_category."showposts=".get_option("ocmx_home_page_posts"));
    	endif; ?>
    
    	<ul class="double-cloumn clearfix">
        	<li id="left-column">
            	<ul class="blog-main-post-container">
                <?php
                query_posts('cat=-3');
                if (have_posts()) : while (have_posts()) : the_post();
                    setup_postdata($post);
    				$link = get_permalink($post->ID);
                    $image = get_obox_image(528, '240', '', 'div', 'post-image', true); ?>
    				<li class="post">
    					<?php echo $image; ?>
    				    <h2 class="post-title"><a href="<?php echo $link; ?>"><?php the_title(); ?></a></h2>
    
    				    <div class="dater">
    						<span class="month"><?php echo date_i18n('M', strtotime($post->post_date)); ?></span>
    						<span class="day"><?php echo date_i18n('jS', strtotime($post->post_date)); ?></span>
    					</div>
    
    				    <div class="copy clearfix">
    				        <?php if($post->post_excerpt !== "") :
    				            the_excerpt();
    				        else :
    				            the_content("");
    				        endif; ?>
    				        <?php if(get_option("ocmx_meta_reading") != "false"): ?>
    				        	<p><a href="<?php echo $link; ?>" class="action-link"><?php _e("Continue lendo. &rarr;", "ocmx"); ?></a></p>
    				      <?php endif; ?>
    				    </div>
    				</li>
                <?php endwhile; ?>
    
    <div align='left'><?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div>
    
    	        <?php else: ?>
    	            <div class="no-posts clearfix">
    	                <h1><?php _e("No post found"); ?></h1>
    	                <p><?php _e("Sorry, no posts matched your criteria."); ?></p>
    	            </div>
    	        <?php endif; ?>
                </ul>
                <?php motionpic_pagination("clearfix", "pagination clearfix"); ?>
            </li>
        	<?php get_sidebar(); ?>
    	</ul>
    <?php endif; ?>
    <?php get_footer(); ?>
    Thread Starter ftrabbold

    (@ftrabbold)

    Hey jbusci!

    WORKS!
    Man you can’t imagine how happy I am now!

    I have changed some lines with your code and the part “category name” changed for the theme cat name. Worked!

    Thanks a lot!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pagination error’ is closed to new replies.