WordPress.org

Ready to get started?Download WordPress

Forums

List category posts
Can't style the template php file - not updating (8 posts)

  1. robertallen
    Member
    Posted 1 year ago #

    Hi all,

    I have been trying to style the default.php template file, but it's not updating at all on the page.

    Here is my shortcode:
    [catlist id=42 numberposts=5 thumbnail=yes author=yes comments=yes excerpt=yes posts_morelink="Read More..." ]

    And all I'm doing in the PHP file is this...
    $lcp_display_output .= '</li><hr />';

    or
    $lcp_display_output .= '<div id="blog_thumbnail">'

    Any ideas on what I'm missing that the default.php template file is not being updated? I've tested the file in both Dreamweaver and WP code editor it's being written to. I've cleared my browser cache and everything.

    What am I missing?

    http://wordpress.org/extend/plugins/list-category-posts/

  2. lanyard13
    Member
    Posted 1 year ago #

    Hey, I just figured this out! It's not actually in the PHP file. You style it in the short code itself.

    These are the elements that can be styled in the shortcode directly:
    author_tag, author_class, catlink_tag, catlink_class, comments_tag, comments_class, date_tag, date_class,excerpt_tag, excerpt_class, morelink_class, thumbnail_class, title_tag, title_class, posts_morelink_class

    So, I wanted the post title/link to be an h3 header tag so here is what I did to put h4 tags around it based on the available parameters:
    [catlist id=4 numberposts=10 title_tag=h3 title_class=lcptitle excerpt=yes thumbnail=yes posts_morelink="Read More"]

    There is a way to make a template file of your own but this was enough for me. Hope that helps!

  3. robertallen
    Member
    Posted 1 year ago #

    Hi there. Thank you so much for your reply. I have tried that, but unfortunately some of the stylings I need to do require me to position the items in a special order, which I need to edit in the PHP file itself.

    I also need to add some things like a divider between the posts at the bottom. I would use absolute positioning, but I was hoping there'd be a cleaner way to do it.

  4. skyoyugi
    Member
    Posted 1 year ago #

    I had the same challenge e.g. I wanted to have the image to the left, then the Title, Date of posting and excerpt,as well as read more on the left. Anyone with a solution?

    2. I wanted to add the words "Published on" next to the post publishing date. Any idea how this can be done?

    Otherwise thanks a lot for the nice plugin

  5. robertallen
    Member
    Posted 1 year ago #

    Yeah, unless you can't edit the PHP file, it won't work.

    I edited the PHP file with a simple echo "test"; just to see if it shows up, no changes occur on the page.

    The plugin doesn't seem to be connecting to that template file at all.

    I even tried template=default in the shortcode of WordPress and still nothing.

  6. skyoyugi
    Member
    Posted 1 year ago #

    @robertallen not really. Just play with the CSS, and you are good to go.
    I managed to handle the situation, 80% of it at least. This is how:

    1. The shortcode (add to the page where the post will be displayed):
    [catlist name=from-the-blog numberposts=1 title=yes title_tag=h3 title_class=from-the-blog-title date=yes dateformat="l F dS, Y" date_tag=p date_class=from-the-blog-datetime thumbnail=yes thumbnail_size=200 thumbnail_class=from-the-blog-img excerpt=yes excerpt_strip=no excerpt_tag=span excerpt_class=from-the-blog-excerpt excerpt_size=45 posts_morelink="Read the Full Article" posts_morelink_class=from-the-blog-readmore]

    2. The CSS (have this in your style.css file)
    /* =Front Page Featured Area Styling
    -------------------------------------------------------------- */
    .from-the-blog-img {
    float: left;
    padding: 0 15px 20px 0;
    }

    .from-the-blog-title {
    font-family: 'Oswald', arial;
    margin: 0;
    }

    .from-the-blog-title a {
    text-decoration: none;
    color: #0084B4;
    font-weight: normal;
    }
    .featured a:hover {
    color: #E29F22;
    }

    .from-the-blog-datetime {
    font-style: italic;
    font-size: 0.9em;
    margin: 0;
    }
    .from-the-blog-readmore {
    display:block;
    }

    from-the-blog-excerpt {
    display: block;
    font-family: sans-serif;
    font-size: 14px;
    }

    ul.lcp_catlist {
    padding:0;
    margin:0;
    }

    .lcp_catlist li {
    list-style-type: none;
    overflow: auto;
    }

    .lcp_catlist li:hover {
    background: #FFFFCC;
    cursor: pointer;
    }

    And that's it! Worked perfect for me. Hope it helps someone

  7. robertallen
    Member
    Posted 1 year ago #

    I appreciate it.

    There were a few things that I needed to add to the actual PHP files, which I figured out. It was in CatListDisplayer.php.

    So for author it says...
    $lcp_display_output .= $this->get_author($single, $this->params['author_tag']);

    I just added a "by" so it would say "by Username here".

    $lcp_display_output .= "<div class='blogMeta'>" . "by " . $this->get_author($single, $this->params['author_tag']);

    Again minor little things, but editing the CatListDisplayer.php file in the plugin folder worked great! Make sure you back up the original first, and then start messing around with it. If you know PHP then it should be easy to find stuff.

    I only know a tiny bit of PHP, and was able to rearrange and add lots of different things that I needed inside the code.

  8. skyoyugi
    Member
    Posted 1 year ago #

    Thanks @robertallen. Will definitely try that out as well

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic