Add Pagination To Your WordPress Without Any Plugin
You could say that today’s another “No Plugin Day” as I once again feature another useful WordPress trick that will help you customize your site sans the plugins. This tutorial was shared by Chunlinsay of WooShift and it shows you how to add pagination links to your WordPress.
Again, as with most WordPress hacks and tricks, this one won’t require you to do much to customize your blog. All it takes is for you to add a snippet of code into your functions.php file.
Copy and paste the following code below in to your functions.php file:
function get_pagenavi () { global $wp_query, $wp_rewrite; $wp_query -> query_vars['paged'] > 1 ? $current = $wp_query -> query_vars['paged'] : $current = 1; $pagination = array( 'base' => @add_query_arg('page', '%#%'), 'format' => '', 'total' => $wp_query -> max_num_pages, 'current' => $current, 'mid_size' => 5, 'prev_text' => '?', 'next_text' => '?' ); if ($wp_rewrite -> using_permalinks()) { $pagination['base'] = user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged'); } if (!empty($wp_query -> query_vars['s'])) { $pagination['add_args'] = array('s' => get_query_var('s')); } echo paginate_links($pagination); }
Next, place this is into any theme templates where you want the pagination links to be displayed (ex. index.php, category.php, etc.):
<div><?php get_pagenavi(); ?></div>
And that’s basically it! Congratulations. You now have pagination links.
Incoming search terms for the article:
- wordpress pagination without plugin
- wordpress pagination tutorial 2012
- pagination in wordpress without plugin
- pagination wordpress without plugin
- jquery pagination
- wordpress $pagination = array( on page
- pagination tutorial
- wordpress pagination plugin
- pagination without plugin wordpress
- add pagination in Market commentary wordpress plugin
No comments
Membuat Pagination di WordPress Tanpa Plugin « Catatan Omje
08.23.2012
[...] Add Pagination To Your WordPress Without Any Plugin | Blogfreakz - Web Design and Web Developm…. Share:FacebookTwitterEmail [...]
There are no trackbacks to display at this time.