WordPress.org

Ready to get started?Download WordPress

Forums

List category posts
Sharing my own template in LCP (7 posts)

  1. Chocolaterebel
    Member
    Posted 3 years ago #

    Okay, with some effort I patched together a solution which I'll share here for everyone who ever wanted to put a category into a page. My coding's pretty messy, and I won't claim to know PHP, but it worked for me. :)

    Plugin used: [url=http://wordpress.org/extend/plugins/list-category-posts/]List Category Posts[/url] (modified)
    Example: [url=http://www.drowtales.com/wordpress/?page_id=301]Podcasts page[/url] (using Pagelines Pro)

    From here on I'll refer to List Category Posts as LCP since it's kind of a handful to type all the time.

    LCP has 4 php files that direct the plugin:

    lcp_widget_form.php
    list_cat_posts.php
    list_cat_posts_widget.php
    templates/default.php

    I only modified two files, list_cat_posts.php and default.php. default.php is an example of LCP's template system, see the plugin site for more information about this.

    LCP had a couple of bugs that I had to sort through before I could make it work the way I wanted it to, and most of those fixes I found while browsing the support forum on wordpress. Feel free to improve upon the changes I've made. :)

    the modified list_cat_posts.php file:

    [Moderator note: snipped code block, please use the pastebin as per the Forum Guidelines]

    Just a reminder, I'm not a programmer, so I won't be able to give any support in regards to things that don't work. If it does work for you, please let me know! :)

  2. Soccerwidow
    Member
    Posted 3 years ago #

    Thank you for the code. It must have taken days to try to fix this flawed plugin. I finally gave up.

    I replied in a separate topic: Plugin "List Category Posts" has too many faults and also referred to your article in my website Soccerwidow.

  3. fernandobt
    Member
    Plugin Author

    Posted 3 years ago #

    Hey, thanks for posting the code! I'm using the class attribute on version 0.14. I know the template system is pretty sloppy right now, but I haven't had time to implement something better. It's on the roadmap for version 1.0, so stay tuned :)

  4. Chocolaterebel
    Member
    Posted 3 years ago #

    Looking forward to it! I wish I could edit my previous post, I somehow broke the page posting so much code. :b I'll know better for next time.

    I'll update to the latest version and report back later about how it went. :)

    I should mention that the template I'm using is specifically for the wordpress theme I have (Pagelines Pro), especially due to the css styling. I'll see if I can export the css components such that the plugin looks like what I have right now, though it may not be for a while. :)

  5. fernandobt
    Member
    Plugin Author

    Posted 3 years ago #

    Ok, just let me know how it went on this post, and I'll get notified on my email.

    Any feedback on the template system is very welcome. Since this release, I'm starting to think on how to implement it to make it more user friendly, so it's the perfect time for good ideas :)

    Thanks for using the plugin and posting about it!
    Regards

  6. Chocolaterebel
    Member
    Posted 3 years ago #

    Okay, I made the update and then imported the small things which made it work on my site. :) On retrospect I realize I didn't take note of all of the things I moved over, but I'll note a few I remember off hand:

    list_cat_posts.php

    // File locations lower in list override others
    		STYLESHEETPATH.'/list-category-posts/'.$atts['template'].'.php',
    	);

    to:

    // File locations lower in list override others
    		WP_PLUGIN_DIR.'/list-category-posts/templates/'.$atts['template'].'.php',
    	);

    But once I did this, it was reporting back errors from the default.php template due to the thumbnail function not working when a post does not have a thumbnail (at least that's how I understood it). I put in the if clause that another person suggested in the forum. I also adjusted the Show Category code in default.php.

    I'll just copy paste the entire files at the end of my post in case I missed something. :)

    One thing that I'm working to use in my site is the widget, and the widget uses the default.php template automatically (unless the user changes it in lcp_cat_posts_widget.php). New feature idea: Like the [catlist] function, it would be great if the LCP widget has an entry for custom templates.

    In regards to my own custom template, it didn't work with the new update until I fixed some of the changed functions/variables. I will have time later to parse through my css to get the styles necessary to make my template look as it should. :)

    Here are the php files as I've tweaked them:

    list_cat_posts.php

    [Moderator note: snipped code block, please use the pastebin as per the Forum Guidelines]

  7. Chocolaterebel
    Member
    Posted 3 years ago #

    Pasting the code again, with appropriate links this time (as to not break the page again). :)

    list_cat_posts.php
    http://wordpress.pastebin.com/TNh4LheV

    default.php
    http://wordpress.pastebin.com/KsaTxgSc

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic