• The buttons of WP Paginate are being displayed sucessfully, but only content from first page is being displayed.

    Mybe there is a problem with my query?

    <?php query_posts('cat=5'); ?>
     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>
    
     <?php endwhile; else: ?>
    
    <?php _e('Sorry, no posts matched your criteria.'); ?>
     <?php endif; ?>
    
    <?php
    	if(function_exists('wp_paginate')) {
    		wp_paginate();
    	}
    	else {
    		twentyfourteen_paging_nav();
    	} 
    ?>

    Thank you for possible solution ?? I would highly appreciate it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author AlanP57

    (@alanp57)

    Using WP_query is the preferred way to do it. Try this;

    
    <?php $cat_posts = new WP_query(array('cat' => 5));  ?>
    
     <?php if ($cat_posts->have_posts()) : while ($cat_posts->have_posts()) : $cat_posts->the_post(); ?>
     
    <?php the_content(); ?>
    
     <?php endwhile; else: ?>
    
    <?php _e('Sorry, no posts matched your criteria.'); ?>
     <?php endif; ?>
    
    <?php
      if(function_exists('wp_paginate')) {
        wp_paginate();
      } else {
        twentyfourteen_paging_nav();
      } 
    ?>
    
    Thread Starter maresj

    (@maresj)

    Dear Alan,

    thank you for your reply, but unfortunately that code did not work also.

    If anyone is interested, the blog is at https://www.bydlimenaproseku.cz/blog/

    Plugin Author AlanP57

    (@alanp57)

    You could try turning on WordPress debugging to see if there are any errors preventing pagination from working. To turn on WordPress debugging, edit the wp-config.php file and change

    define('WP_DEBUG', false);

    to

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors', 0);

    (Be sure to change this back when you are done.)

    Now different kinds of messages, some will not related to WP-Pagination, will be written to a debug.log file in the wp-content folder. If you find any errors, fixing them may solve your pagination issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘First page content being displayed only’ is closed to new replies.