Jump to content

How can i do pagination with wordpress?


colap

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/

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.