JavaScript Editor Ajax software     Free javascripts 



Main Page

Figure 16-16
The following plugin does the trick. Save it as
pagerfix.php
in your
blog/wp-content/plugins
folder, then activate it from the administration page:
<?php
/*
Plugin Name: PagerFix
Plugin URI: http://www.seoegghead.com/
Description: Makes the paging in WP more SE-friendly.
Author: Jaimie Sirovich
Version: 1.0
Author URI: http://www.seoegghead.com/
*/
function pager_fix($separator = ‘ | ‘,
$after_previous = ‘&nbsp;&nbsp;’,
$before_next = ‘&nbsp;&nbsp;’,
$prelabel=’&laquo; Previous Page’,
$nxtlabel=’Next Page &raquo;’,
$current_page_tag = ‘b’)
{
global $request, $posts_per_page, $wpdb, $paged;
posts_nav_link(‘’,$prelabel,’‘);
echo $after_previous;
preg_match(‘#FROM (.*) GROUP BY#‘, $request, $matches);
$fromwhere = $matches[1];
$numposts = $wpdb->get_var(“SELECT COUNT(ID) FROM $fromwhere”);
$max_num_pages = ceil($numposts / $posts_per_page);
if ($max_num_pages > 1)
{
306
Chapter 16: : Creating an SE-Friendly Blog
c16.qxd:c16 11:04 306


JavaScript Editor Ajax software     Free javascripts