The code below creates a plugin that appends the contents of $content to "the_content" on the hompage. It works fine when I set $content to a static value. However, I'm trying to set it to draw out the site's active categories as a list. However, nothing happens when I set $content to wp_list_categories()
Ultimately, I want to hack into the wp_list_categories function and display the thumbnail image that's been assigned to the category (still have to enable the code to do that as well).
This is the first evolution of the plugin and I'm just attempting to get it to list the categories and descriptions before I build in the thumbnail support.
<?php
/*
Plugin Name: List Categories with Thumbnail Images
*/
add_filter( 'the_content', 'cb_category_listing' );
function cb_category_listing( $content )
{
if ( is_home() ) {
// $content .= '<p>Hello World!</p>';
$cat_args['title_li'] = '';
$myContent = wp_list_categories(apply_filters('widget_categories_args', $cat_args));
$content .= $myContent;
}
return $content;
}
add_action( 'init','cb_category_listing');