SEO Egghead by Jaimie Sirovich: A blog about SEO, written for nerds, by a nerd.

Choose a Topic:

» Suggest a topic or buzz to cover; if I write about it, you'll get credit with a link in the post!

Wed
18
Apr '07

Updated PagerFix Plugin Code For WP 2.1

I upgraded to WordPress 2.1 today, and one of my plugins blew everything up. Here it is revised for WordPress 2.1. Enjoy!:

Download source code here


<?

/*
Plugin Name: PagerFix
Plugin URI: http://www.seoegghead.com/
Description: Makes the paging in WP more SE-friendly.

Author: Jaimie Sirovich
Version: 1.1 for WP 2.1
Author URI: http://www.seoegghead.com/
*/ 

function pager_fix($seperator ' | '$after_previous '&nbsp;&nbsp;'$before_next '&nbsp;&nbsp;'$prelabel='&laquo; Previous Page'$nxtlabel='Next Page &raquo;'$current_page_tag 'b')

{    
    global $posts_per_page$paged$wp_query;
    
    posts_nav_link('',$prelabel,'');

    echo $after_previous;
        
    $numposts $wp_query->found_posts;
    
    $max_num_pages ceil($numposts $posts_per_page);

    if ($max_num_pages 1) {

        for ($cnt 1$cnt <= $max_num_pages$cnt++) {

            if ($current_page_tag && $paged == $cnt) {
                $begin_link "<$current_page_tag>"$end_link "</$current_page_tag>";

            } else {
                $begin_link ''$end_link '';
            }
            
            $x[] = $begin_link '<a href="' get_pagenum_link($cnt) . '">' $cnt '</a>' $end_link;

            
        }
    
        echo join($seperator$x);
        
    }
    echo $before_next;
    posts_nav_link('','',$nxtlabel);

    
}

?>

The old documentation/blog post is here.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Furl
  • Reddit
  E-Mail This Post/Page

3 Responses to “Updated PagerFix Plugin Code For WP 2.1”

  1. Dog Says:

    Nice plugin, but it seems to break my RSS feed generation.

    Looking for the glitch now.

    Cheers

    Dave

  2. Can Excessive Outbound Linking Hurt Your Rankings? | Search Engine Optimisation & Online Marketing Ireland .:. Red Cardinal Says:

    [...] inherent pagination issues. These can be solved using Jamie Sirovich’s excellent PagerFix [...]

  3. WordPress subpages going supplemental: the fix - SEO Blog - Joost de Valk Says:

    [...] changed the pagination using Jaimie’s pagerfix plugin which he was kind enough to update for WordPress [...]

Leave a Reply