ThemeShaper Forums » Thematic

removing or changing 'Published' from entry-meta class

(11 posts)
  • Started 5 years ago by sbing7
  • Latest reply from gelay
  • This topic is resolved
  1. Small issue: I'd like to be able to change or remove the word 'Published' that appears just before the date of each post but... I can't find it! Where can I alter or display:none that word?

    Posted 5 years ago #
  2. Hey ..

    sorry .. we ran out of "display:none" for today ;-)

    Try this one in your functions.php:

    function change_published($postmeta) {
        $postmeta = str_replace(__('Published: ', 'thematic'),'',$postmeta);
        return $postmeta;
    }
    add_filter('thematic_postheader_postmeta', 'change_published');

    Code tested and approved :-)

    Cheers,

    Chris

    Posted 5 years ago #
  3. Precisely what I needed! Thank you.

    And (I learned by quick test) adding something like 'Posted: ' between the empty quotes enables me to change 'Published' to whatever I want. Cool.

    Posted 5 years ago #
  4. Nice Chris. Thanks as always.

    I have another one for you: How would you remove everything from the postmeta data except the date? No "By NAME | Published: "?

    Thanks again. Nice day to you.

    Posted 5 years ago #
  5. @ http://forums.themeshaper.com/topic/how-to-remove-timestamp-and-by

    Without css display:none.

    Chris, any ideas? I think you dont like display:none too.

    Posted 5 years ago #
  6. If you change the line $postmeta = .. in the function mentioned above to:

    $postmeta = '<div class="entry-meta">';
        $postmeta .= '<span class="entry-date"><abbr class="published" title="';
        $postmeta .= get_the_time(thematic_time_title()) . '">';
        $postmeta .= get_the_time(thematic_time_display());
        $postmeta .= '</abbr></span>';
        // Display edit link
        if (current_user_can('edit_posts')) {
            $postmeta .= ' <span class="meta-sep">|</span> ' . $posteditlink;
        }
        $postmeta .= "</div><!-- .entry-meta -->\n";

    Sorry .. rebuilding the whole thing with the filter is easier in this case.

    Haven't tested this code but it should work. (sorry .. an insurance loss and a couple of constructional defects are keeping me busy these days)

    Cheers,

    Chris

    Posted 5 years ago #
  7. Thanks Chris. Sorry to hear about your worries. Thanks again.

    Posted 5 years ago #
  8. Nothing private .. both things are customer related causing a lot of work for me. Need to figure out, if I can charge the insurance for at least 20 hours work. ;-)

    Posted 5 years ago #
  9. Sorry. The above function removes the everything, including the Date. Thanks anyway.

    Posted 5 years ago #
  10. You should have something like:

    function change_published($postmeta) {
    
            // Create $posteditlink
        $posteditlink .= '<a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&amp;post=' . $id;
        $posteditlink .= '" title="' . __('Edit post', 'thematic') .'">';
        $posteditlink .= __('Edit', 'thematic') . '</a>';
    
        $postmeta = '<div class="entry-meta">';
        $postmeta .= '<span class="entry-date"><abbr class="published" title="';
        $postmeta .= get_the_time(thematic_time_title()) . '">';
        $postmeta .= get_the_time(thematic_time_display());
        $postmeta .= '</abbr></span>';
        // Display edit link
        if (current_user_can('edit_posts')) {
            $postmeta .= ' <span class="meta-sep">|</span> ' . $posteditlink;
        }
        $postmeta .= "</div><!-- .entry-meta -->\n";
        return $postmeta;
    }
    add_filter('thematic_postheader_postmeta', 'change_published');

    in your functions.php.

    Did a test with this code and it leaves just the date plus the edit link in case your logged in.

    Could you please check your code?

    Thanks,

    Chris

    Edited one more time .. haven't checked the condition logged in before .. now it works as expected.

    Posted 5 years ago #
  11. Works. Thanks, thanks, thanks.

    Posted 5 years ago #

RSS feed for this topic

Reply

You must log in to post.