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:
-
$category_link = get_category_link( $category->category_id );
with
-
$category_link = get_category_link( $category->cat_ID );












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 );
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;