WP 3.0.4
local installation, multisite network enabled
theme: Twentyten
plugin: List Category Posts v .15, network activated

I've created the folder list-category-posts inside my theme folder, and placed default.php inside it. Edited default.php and saved as lcp_template_1.php inside same folder. However, the changes are not appearing at all. I'm trying to change the style of the lcp output from the default <ul> to <div> classes defined in my theme (child)'s style.css. NOT WORKING.

That is, the plugin is functioning, but the style changes are not working.

Code for my template file is up at http://wordpress.pastebin.com/EGmrkerQ

Please help. Sorry, no url for viewing the output, because this is a local installation.

Oh, btw, I should mention that in the shortcode I have called for the new template, as follows: [catlist id=1 template=lcp_template_1].

2 Answers 2


Hey you just opened the plugin's tag on WordPress Answers :D

Can you paste the code of the generated html? From what you describe, you are using it correctly, so I just want to see if the template is being loaded to detect if the problem is on the template side, or a bug on the plugin's code.

UPDATE: Ok, I checked your template on a new WordPress install. It was getting the template, but there was some code error, here's what worked for me:

I created the list-category-posts folder under wp-content/themes/twentyten and added a new php file called "lcp_template_1.php" with your code. Then created a new post with:

[catlist template=lcp_template_1]

Now, I started editing your template, I fixed the Show Category code and it's currently working with this code:

Plugin Info & license stuff...
$lcp_output = '';    
//Show category?
    if ($atts['catlink'] == 'yes'){
        $cat_link = get_category_link($lcp_category_id);
        $cat_title = get_cat_name($lcp_category_id);
        $lcp_output = '<div class="topic-heading"><a href="' . $cat_link . '" title="' . $cat_title . '">' . $cat_title . '</a></div>';
$lcp_output .= '<div class="post">';//For default ul

//Posts loop:

foreach($catposts as $single):
    $lcp_output .= '<h2 class="entry-title"><a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a></h2>';
    //Show comments?
    if($atts['comments'] == yes){
        $lcp_output .= ' (' . $single->comment_count . ')';
    //Style for date:
        $lcp_output .= ' <div class="entry-meta"> ' . get_the_time($atts['dateformat'], $single) . '</div>';
    //Show author?
        $lcp_userdata = get_userdata($single->post_author);
        $lcp_output .=' <div class="entry-meta">' .$lcp_userdata->display_name . '</div>';
    //Show thumbnail?
        $lcp_output .= '<div class="lcp_thumbnail"><a href="' . get_permalink($single->ID) . '">' . get_the_post_thumbnail($single->ID, array('40','40')) .'</a></div>';

    //Show content?
    if($atts['content']=='yes' && $single->post_content){
        $lcpcontent = apply_filters('the_content', $single->post_content); // added to parse shortcodes
        $lcpcontent = str_replace(']]>', ']]&gt', $lcpcontent); // added to parse shortcodes
        $lcp_output .= '<p>' . $lcpcontent . '</p>'; // line tweaked to output filtered content
    //Show excerpt?
    if($atts['excerpt']=='yes' && !($atts['content']=='yes' && $single->post_content) ){
        $lcp_output .= lcp_excerpt($single);
$lcp_output .= '</div>';

Please let me know if this works for you. I should update the default template since the show category code is old and buggy. Will be done for next version.

UPDATE: 0.15.1 includes a fix for the undeclared lcp_output variable. Also, regarding the thumbnail not displaying, please make sure you've modified the theme according to the get_the_post_thumbnail documentation.

To enable post thumbnails, the current theme must include add_theme_support( 'post-thumbnails' ); in its functions.php file. add_theme_support( 'post-thumbnails' ); must be called before the init hook is fired. That means it needs to be placed directly into functions.php or within a function attached to the after_setup_theme hook.


As we found out on the comments, the problem was with using STYLESHEETPATH instead of TEMPLATEPATH. This change will be included on the next release. Thanks Das for the feedback :D

  • Fernando, thank you so much for your trouble, but it is still not working... I copied your code and saved as, but looks like the template is not called. I've pasted the source code for the page on which the short code is activated: wordpress.pastebin.com/a9w6Evuw. Next step is to go into my wp-config and activate debugging, then I'll let you know what turns up.
    – user2760
    Jan 28, 2011 at 0:06
  • Fernando, debugging reports: Notice: Undefined variable: lcp_output in /Users/das/Documents/Websites/Bhaktivedantas-dev/public_html/wp-content/plugins/list-category-posts/list_cat_posts.php on line 150 Notice: Use of undefined constant yes - assumed 'yes' in /Users/das/Documents/Websites/Bhaktivedantas-dev/public_html/wp-content/plugins/list-category-posts/list_cat_posts.php on line 152 Notice: Undefined variable: post in /Users/das/Documents/Websites/Bhaktivedantas-dev/public_html/wp-content/plugins/list-category-posts/list_cat_posts.php on line 206
    – user2760
    Jan 28, 2011 at 0:11
  • For your convenience, list_cat_posts.php up on pastebin.com: wordpress.pastebin.com/rh64kXw5. Should STYLESHEETPATH be replaced by something else for theme Twentyten? Also, a reminder that the thumbnail is not called along with the post.
    – user2760
    Jan 28, 2011 at 0:22
  • I just modified the code up there, regarding the first error (Undefined variable) which wouldn't happen if the "if" code block was executed. Now, as you mentioned, it appears it's using the default style, and the template is not being called (I see <ul class="lcp_catlist"> in the code). Actually, I think I did find a bug regarding the messages you just pasted from debugging, I'll look into it and see if I can role a new release today. Thanks! Jan 28, 2011 at 14:10
  • Thank you again, and looking forward to it. I want to say that the plugin is really useful. I'm using it on my main site's home page (using php to call a page containing the LCP shortcode into a designated section on the home page - which is not a static page, btw). Very much appreciative of the work you've put into it. I'm also learning a lot in the process of reorganizing a large website with Wordpress, and it's taking me hours and hours to get things set up. It's my first time creating the multisite network, and I'm not really handy with php.
    – user2760
    Jan 28, 2011 at 15:32

Shortcode: [catlist template=lcp_template_1 id=9 orderby=date numberposts=1 date=yes author=yes excerpt=yes catlink=yes thumbnail=yes ]

In the plugin folder > list_cat_posts.php, these are the instances for 'thumbnail':

File list_cat_posts.php; line 56: 'thumbnail' => 'no',

File list_cat_posts.php; line 168: if ($atts['thumbnail']=='yes'){

File list_cat_posts.php; line 169: $lcp_display_output .= lcp_thumbnail($single);

File list_cat_posts.php; line 229: * @see http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

File list_cat_posts.php; 232: function lcp_thumbnail($single){

File list_cat_posts.php; line 233: $lcp_thumbnail = '';

File list_cat_posts.php; line 234: if ( has_post_thumbnail($single->ID) ) {

File list_cat_posts.php; line 235: $lcp_thumbnail = get_the_post_thumbnail($single->ID);

File list_cat_posts.php; line 237: return $lcp_thumbnail;

And in my template, these are the instances for 'thumbnail':

//Show thumbnail? if($atts['thumbnail']=='yes'){ $lcp_output .= '<div class="lcp_thumbnail"><a href="' . get_permalink($single->ID) . '">' . get_the_post_thumbnail($single->ID, array('40','40')) .'</a></div>'; }

So there is no misspelling, as far as I can see. I had already seen the forum thread you're referring to, and made the correction to the default template.

The thumbnail is displaying as expected in the original post, so I don't know why LCP is not pulling it along with the post. Unless it doesn't do that with excerpts?

  • I'll do some more testing today. It's probably related to the problem on the WordPress forum, since the user can't get thumbnails to work either. Feb 8, 2011 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.