$ The use of pagenavi plugin $
After the activation and installation of pagenavi, there is a need to modify the files of index.php and categary.php, and this is a little difficult to the blogger.
Take a index.php in a theme for example,
The original file is:
<?php get_header(); ?>
<div id=â€containerâ€>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class=â€post†id=â€post-<?php the_ID(); ?>â€>
<h2 class=â€title_linkâ€><a href=â€<?php the_permalink(); ?>†title=â€<?php the_title(); ?>â€>
<?php the_title(); ?>
</a></h2>
<div class=â€smallfontâ€><?php the_time(’F jS, Y’) ?> <?php _e(’by’); ?> <?php the_author(); ?></div>
<div class=â€entryâ€>
<?php the_content(); ?>
<div class=â€postmetadataâ€>
<div class=â€ipost_tagâ€>Filed under :
<?php the_category(’, ‘) ?>
</div>
<div class=â€ipost_commentâ€><img src=â€<?php bloginfo(’stylesheet_directory’); ?>/images/comment.gif†width=â€16″ height=â€16″ alt=â€tag†align=â€top†/>
<?php comments_popup_link(’0 Comment »â€™, ‘1 Comment »â€™, ‘% Comments »â€™); ?>
<?php edit_post_link(’Edit’, ‘ | ‘, â€); ?>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<div class=â€navigationâ€>
<div id=â€nav_leftâ€>
<?php posts_nav_link(’ ‘, ‘« Previous Page’, â€); ?>
</div>
<div id=â€nav_rightâ€>
<?php posts_nav_link(’ ‘, â€, ‘Next Page »â€™); ?>
</div>
</div>
<?php else : ?>
<div class=â€post†id=â€post-<?php the_ID(); ?>â€>
<h2>
<?php _e(â€Not Foundâ€); ?>
</h2>
</div>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
The following are the modified codes,please pay attention to the uderlined lines in the section of <div class=â€navigationâ€>:
<?php get_header(); ?>
<div id=â€containerâ€>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class=â€post†id=â€post-<?php the_ID(); ?>â€>
<h2 class=â€title_linkâ€><a href=â€<?php the_permalink(); ?>†title=â€<?php the_title(); ?>â€>
<?php the_title(); ?>
</a></h2>
<div class=â€smallfontâ€><?php the_time(’F jS, Y’) ?> <?php _e(’by’); ?> <?php the_author(); ?></div>
<div class=â€entryâ€>
<?php
if (is_single()) {
the_content();
}
else {//no content, nothing.
}
?>
<div class=â€postmetadataâ€>
<div class=â€ipost_tagâ€>Filed under :
<?php the_category(’, ‘) ?>
</div>
<div class=â€ipost_commentâ€><img src=â€<?php bloginfo(’stylesheet_directory’); ?>/images/comment.gif†width=â€16″ height=â€16″ alt=â€tag†align=â€top†/>
<?php comments_popup_link(’0 Comment »â€™, ‘1 Comment »â€™, ‘% Comments »â€™); ?>
<?php edit_post_link(’Edit’, ‘ | ‘, â€); ?>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<div class=â€navigationâ€>
<?php if(function_exists(’wp_pagenavi’)) : ?>
<?php wp_pagenavi() ?>
<?php else : ?>
<div id=â€nav_leftâ€>
<?php posts_nav_link(’ ‘, ‘« Previous Page’, â€); ?>
</div>
<div id=â€nav_rightâ€>
<?php posts_nav_link(’ ‘, â€, ‘Next Page »â€™); ?>
</div>
<?php endif; ?>
</div>
<?php else : ?>
<div class=â€post†id=â€post-<?php the_ID(); ?>â€>
<h2>
<?php _e(â€Not Foundâ€); ?>
</h2>
</div>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
Related Blogs
- Related Blogs on pagenavi
- How to: Integrate a pagination in your WordPress theme
- Plugin: WP-PageNavi SEO
- WP Page Navi – advanced paging navigation for your Wordpress blog
- WP-PageNavi ç®€ä½“ä¸æ–‡ç‰ˆ
- Related Blogs on wordpress
- Dyne Wordpress Theme – 3100+ downloads from Wordpress.org alone
- Remove Textile from a Wordpress blog