New here? Then you may want to subscribe to my rss feed. :)

WP Plugin Fix: Customizable Post Listings

April 7th, 2007 | Posted in Development, Wordpress | 2 Comments

I wanted a way of listing the five most recent posts both below the actual post and on the home page. I discovered Customizable Post Listings which was an enhanced version of one developed by www.coffee2code.com that did exactly what I needed.

I encountered a small bug where it would not return the correct category link when using %post_categories_url% . It failed to return the actual category id (or name depending in your permalink structure). e.g. index.php?cat=

To correct the bug, on line 348 (or thereabouts) replace:

  1. $category_link = get_category_link( $category->category_id );

with

  1. $category_link = get_category_link( $category->cat_ID );

2 Responses to “WP Plugin Fix: Customizable Post Listings”

  • Gravatar
    Shane Location: United States //

    What version of Customizable Post Listings are you using? I couldn’t find the below the line anywhere in the v1.1 or v1.5 files:
    $category_link = get_category_link( $category->category_id );

  • Gravatar
    Fiaz Location: Great Britain (UK) //

    My bad… that should have been line 353, well its line 353 in my version which is 1.1.

    This is the entire case:


    case '%post_categories_url%':
    $first = true;
    $catlist = get_the_category( $post->ID );
    $new = '';
    foreach( $catlist as $category )
    {

    if( $first )
    $first=false;
    else
    $new .= $between_categories;
    $category_link = get_category_link( $category->cat_ID );
    $new .= '‘ . $category->cat_name . ‘‘;
    }
    break;

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>