sh_son
Member
Posted 6 months ago #
Hello,
I'm attempting to implement 'pagination' feature into a custom theme but for some reason I am not seeing any text or pagination. I have simply copy and pasted the codes from here (http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/). But after reading through WordPress documentation it seems that I need to have pagination variables in order to have pagination navigation to work.
Can someone point me to a right direction?
Thank you.
from the linked tut:
<?php if (function_exists("pagination")) {
pagination($additional_loop->max_num_pages);
} ?>
this $additional_loop depends on your used query;
for a 'normal' loop this might need to be replaced with $wp_query
it might help if you paste the full code of your template into a pastebin and post the link to it here - see http://codex.wordpress.org/Forum_Welcome#Posting_Code
sh_son
Member
Posted 6 months ago #
Thank you, alchymyth.
I have posted the template code into pastebin here.
As of now I do not have any functions/code relating to pagination, as it kept failing to work.
sh_son
Member
Posted 6 months ago #
I would also like to add that pagination plugins such as 'WP-paginate' does not work.
I'd only assume that I am missing a key piece of code, still going through google search and WordPress documentations.
add the 'paged' parameter to this line:
<?php $the_query = new WP_Query('showposts = 5');?>
like:
<?php $the_query = new WP_Query('posts_per_page = 5 & paged = ' . get_query_var('paged'));?>
then try for instance these basic pagination links somewhere after the <?php endwhile;?>
<?php next_posts_link('Older Entries ยป', $the_query->max_num_pages); ?>
<?php previous_posts_link('Newer Entries', $the_query->max_num_pages); ?>
http://codex.wordpress.org/Class_Reference/WP_Query
http://codex.wordpress.org/Function_Reference/next_posts_link
http://codex.wordpress.org/Function_Reference/previous_posts_link