$ 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