Jump to content

Recommended Posts

How can i do pagination with wordpress?

 

https://codex.wordpress.org/Pagination

<?php if ( have_posts() ) : ?>

<!-- Add the pagination functions here. -->

<!-- Start of the main loop. -->
<?php while ( have_posts() ) : the_post();  ?>

<!-- the rest of your theme's main loop -->

<?php endwhile; ?>
<!-- End of the main loop -->

<!-- Add the pagination functions here. -->

<div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>

<?php else : ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

<!-- Add the pagination functions here. --> , which functions to use here? Can anyone re-write this code with pagination functions?

Link to comment
https://forums.phpfreaks.com/topic/297511-how-can-i-do-pagination-with-wordpress/
Share on other sites

If you want multiple page numbers and links need to get a theme with it built in or download a pagination plugin.

 

Here is a tutorial to add it yourself into the theme if does not exist.

http://www.wpexplorer.com/pagination-wordpress-theme/

 

A plugin that works.

https://wordpress.org/plugins/wp-paginate/

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.