WordPress.org

Ready to get started?Download WordPress

Forums

List category posts
[resolved] Adding text "Posted on:" to date (3 posts)

  1. hunter44
    Member
    Posted 12 months ago #

    I want to add the words "Posted on:" in front of the date.

    The only way I can seem to do this is to edit the plugin file CatListDisplayer.php in the /include directory.

    I'd rather do it somewhere that won't get overwritten when the plugin is updated.

    Can I do this with CSS somehow?

    Has anyone gotten the default.php template file to work? I can't seem to make any changes in default.php take effect...

    Thanks for any help/insights...

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

  2. hunter44
    Member
    Posted 12 months ago #

    Okay, I got the plugin to pick up and read the "default.php" template file by putting a copy of default.php in my child theme (under a folder I created called "List Category Posts" Then I added the text: ' template="default" ' to my short code.

    But I don't know enough PHP to get the word "Posted:" to be included in the "span" clause for the date (I want the styling for the word "Posted:" and the date itself to all be the same).

    In my shortcode I get the date with these three things:
    date=yes date_tag=span date_class=lcp_dateclass

    In default.php I changed the line:
    $lcp_display_output .= $this->get_date($single);
    to:
    $lcp_display_output .= " Posted: " . $this->get_date($single,'span', 'lcp_dateclass');

    My problem is that the word "Posted:" doesn't get included in the SPAN so the CSS doesn't get applied to it... it gets applied only to the date itself...

    Any hints on how to make the SPAN include my text "Posted:" along with the date??????

  3. hunter44
    Member
    Posted 12 months ago #

    Unbelievable. It works. I ended up doing this:

    In default.php (copied into my child theme), I changed the line:
    $lcp_display_output .= $this->get_date($single);

    To this long hairy thing:
    $lcp_display_output .= "<span class='lcp_dateclass'>" . "Posted: " . $this->get_date($single) . "</span>";

    So basically I hard coded a "span" clause into the default.php file that had the word "Posted:" in it along with a call to get the date...

    Then that whole SPAN clause could be formatted by the CSS I had for it in my child styles.css:

    span.lcp_dateclass {
    	font-style: italic;
    	margin-left: 1em;
    }

Reply

You must log in to post.

About this Plugin

About this Topic