• Resolved daitya

    (@daitya)


    Theme: Twentyten (child)
    Installation: local, multisite network enabled

    I would like to edit the styling of the plugin’s output.

    For instance, default.php outputs like this:

    if ($cat_link_string != ''){
    	$lcp_output = '<p><strong>' . $cat_link_string . '</strong></p>';
    }else{
    	$lcp_output = '';
    }

    and

    $lcp_output .= '<ul class="lcp_catlist">';//For default ul
    //Posts loop:
    foreach($catposts as $single):
    	$lcp_output .= '<li><a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a>';
    	}

    I’d like to change the lcp_catlink_string $lcp_output from <p> to a <div class> defined in my style.css (NOTE: the style.css belonging to the child theme).

    And I’d like to change $lcp_output.= '<ul class="lcp_catlist">' so that it is no longer a list, and instead matches the theme’s style for posts, which I believe is <h2 class=”entry-title”> for the title, <div class=”entry-meta”> for the date and author, and <div class=”entry-content”> for the content.

    But when I saved these changes, there was no change at all to the appearance of the post on the page. Not even after refreshing browser and flushing browser cache. ??

    What am I missing? Help very much appreciated.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter daitya

    (@daitya)

    I should mention here that I have created the list-category-posts folder inside the theme folder, and placed the default.php and my variant template file there.

    For reference, here is my modified template file (lcp_template_1.php) up at wordpress.pastebin.com.

    Templates for the List Category Plugin are searched for in your WordPress theme’s folder. You should create a folder named “list-category-posts” under wp-content/themes/your-theme-folder. Then use this template name as a parameter for catlist. Check out the rest of the documentation about templates:

    https://foro.picandocodigo.net/discussion/253/list-category-posts-using-templates

    Thread Starter daitya

    (@daitya)

    Oh hi, Fernando, great to see you here. I tried a few times to sign up over at your forum site, but the google signup is buggy and then when I tried to use my wordpress.com login, finally it could not connect. Anyway, it’s good to hear from the plugin author. I hope you can help me.

    Yes, I did follow your instructions exactly. I did create a list-category-posts folder under wp-content/themes/twentyten/ and moved the default.php file there, then edited it and saved as a new template in that same folder. Next called the name of the new template in the shortcode ([catlist id=1 template=lcp_template_1]).

    HOWEVER, it is not working at all. I mean, the plugin functions nicely, but I have not been able to modify the styling of its output.

    Please do you mind to look at the template file code up at pastebin? Maybe I have left out some step??

    Hey daitya, I’m following this question here and on wordpress.stackexchange.com ??

    I’ll check the plugin code, maybe you’ve found a bug…

    Thread Starter daitya

    (@daitya)

    Well, the templates seem to work for others, but maybe they’re not using WordPress 3.0.4 or else they’re using a different theme…

    I have only just now tested the thumbnail. Inserted a thumbnail image into post, and checked to see whether LCP has pulled it. Not. Even though I called for it in the shortcode parameters, as follows: [catlist id=1 template=lcp_template_1 numberposts=1 date=yes author=yes excerpt=yes catlink=yes thumbnail=yes].

    posts from specific category – working
    styles from new template – not working
    orderby – haven’t tested, because I’ve specified 1 post
    date – displayed
    author – displayed
    excerpt – displayed
    catlink – displayed
    thumbnail – not working

    daitya check my answer on WordPress Answers. I tested the code you submitted, changed some parts, and it’s working now. Please test it and let me know.

    Thanks!

    Regards

    Thread Starter daitya

    (@daitya)

    This thread still unresolved. The template is not called. Fernando is looking into it, but so far we have not been able to determine why the template is not being called. If any other List Category Post users have successfully imported their own templates into this plugin, working with theme Twentyten, please help. Can it be that the path to the template is wrongly called in the plugin’s list_cat_posts.php? Maybe doesn’t work for Twentyten? This is the relevant code (it’s not too long, so I’ll paste it here):

    `$tplFileName = null
    $possibleTemplates = array (
    //files locations lower in list override others
    STYLESHEETPATH.’/list-category-posts/’.$atts[‘template’].’.php’,);
    foreach ($possibleTemplates as $key => $file) {
    if (is_readable($file)) {
    $tplFileName = $file;}
    }
    if ((!empty($tplFileName)) && (is_readable($tplFileName))) {
    require($tplFileName);
    }
    else {
    //Default template…`

    The customised template file is placed inside wp-content/themes/twentyten/list-category-posts/. I’ve named it in the shortcode, minus the extension. But it is not calling. How to track the error? (Obviously I’m no php expert)

    Thread Starter daitya

    (@daitya)

    FOUND IT! Fernando, I replaced STYLESHEETPATH with TEMPLATEPATH. Came across a post discussing STYLESHEETPATH and child themes, which made me think that, yes, I am using a child theme, and if STYLESHEETPATH is looking inside the child theme folder, then better try TEMPLATEPATH to look inside the parent theme folder. IT’S WORKING!!! YAY! ?? Strange thing is that I did try placing the folder list-category-posts with the template file inside my child theme, but it didn’t work :|. Maybe my customised template was buggy. Thank you again for a great plugin. – Das

    Thanks for sharing the solution. I’ll add this fix on the next version of the plugin.

    Regards!

    I seem to have the same problem. The plugin works perfectly but I can’t get it to pick up my custom template.

    I see that the templatepath/stylesheetpath issue was sorted: https://www.ads-software.com/support/topic/plugin-list-category-posts-change-in-template-path-in-0161?replies=3

    Anything else it could be?

    Thread Starter daitya

    (@daitya)

    Eatanicecream, which version of the plugin are you using? Have you updated to latest version .18.3? If so, the template you created to work with the plugin’s earlier version will no longer work.

    If the plugin is not pulling in the template, then there’s an error either with the path or the template code.

    Could it be a simple oversight? It happened to me – at one point when I thought I had saved my edited template in the wp-content > themes > twentyten > list-category-posts but actually I had mistakenly saved to wp-content > plugins > list-category-posts. Or perhaps a misspelling (typo) of the file name?

    If the path checks out correct, and you’ve updated your template based on the new ‘default.php’ template bundled with the plugin’s upgrade, then re-examine your code.

    You can copy and paste the entire block of code up at wordpress.pastebin.com, come back and give us the link.

    Ok, I got it – did’t realise the template was supposed to be in wp-content/themes/mytheme/list-category-posts, I had it in wp-content/themes/mytheme.

    Phew.

    Another problem…I’m trying to put <h2> tags around the post title. If I’ve got it correctly it should be;

    //Show the title and link to the post:
        $lcp_display_output .= $this->get_post_title($single, 'h2', 'lcp_post_title');

    But that doesn’t work. Also tried

    //Show the title and link to the post:
        $lcp_display_output .= $this->get_post_title($single, 'h2', 'lcp_title');

    and

    //Show the title and link to the post:
        $lcp_display_output .= $this->get_post_title($single, 'h2', 'lcp_get_post_title');

    But they don’t work either. What have I missed?

    Thread Starter daitya

    (@daitya)

    Again, pls clarify which version of the plugin you’re using. If the latest, here’s one template I’m using, modified from the default. See if this helps…

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: List Category Posts] edit default template’ is closed to new replies.