colap Posted July 28, 2015 Share Posted July 28, 2015 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? Quote Link to comment https://forums.phpfreaks.com/topic/297511-how-can-i-do-pagination-with-wordpress/ Share on other sites More sharing options...
QuickOldCar Posted July 28, 2015 Share Posted July 28, 2015 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/ Quote Link to comment https://forums.phpfreaks.com/topic/297511-how-can-i-do-pagination-with-wordpress/#findComment-1517537 Share on other sites More sharing options...
Momentet Posted August 3, 2015 Share Posted August 3, 2015 I can also recommend https://wordpress.org/plugins/wp-paginate/ if you dont want to do coding on your own! And yes it still works even though it has not been updated for a while :-) Quote Link to comment https://forums.phpfreaks.com/topic/297511-how-can-i-do-pagination-with-wordpress/#findComment-1517944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.