Change Read More ( [...] ) string of text and apply a targetable CSS class to it

Hi there!

1) I'd like to request that the ability to change the [...] string of text from the back-end.

<div class="rcpt_item_excerpt"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Lorem ipsum dolor sit […]</div>

2) It would also be great if a targetable CSS class was added to that string so that it could be targeted with CSS. That way I could style it into a clickable button that said "Read More".

3) I'd also like to be able to make the [...] a clickable link to the corresponding post.

I'm sure I could configure this by updating the core plugin files, but I'd hate to have to go that route and have to reapply the hack with each update.

For now, where in the plugin files would [...] so I can change it?

Thanks again!

  • Patrick
    • Support Monkey

    Hi @Rone

    #2 is easy. You can add a CSS classes to the widget which are added to the list output. For example, adding myclass to the widget would enable you to style the "Read More" link like so:
    .myclass .read-more a { your-button-styling-here }

    1 & 3 are a bit more involved. For example, here's an article dealing with removing the ellipsis (...):
    http://wordpress.stackexchange.com/questions/77690/removing-the-from-the-excerpt-returned-by-get-the-excerpt-only-in-some-p

    And a bit of info about the function used is here:
    http://codex.wordpress.org/Function_Reference/get_the_excerpt

  • Rone
    • Site Builder, Child of Zeus

    Thanks for the reply Patrick. Your reply jump-started the hunt for the solution to all three of my requests. :slight_smile:

    Basically all I had to do was add the following code to my functionality plugin, where "read more" replaces the [...] text string appended on excerpts.

    // Changing excerpt more, linking post, assigning CSS class
       function new_excerpt_more($more) {
       global $post;
       return '… <a class="readmoreexcerpt" href="'. get_permalink($post->ID) . '">' . 'read more' . '</a>';
       }
       add_filter('excerpt_more', 'new_excerpt_more');

    You'll also notice I added the class "readmoreexcerpt" in there so that the new "read more" links tacked on to Recent Custom Posts excerpts are fully style-able and position-able via CSS [a.readmoreexcerpt]

    Also, sorry I'm replying so late but even with the "BE NOTIFIED OF FOLLOW-UP POSTS VIA EMAIL" box checked I don't get email notifications on WPMUDev threads I've subscribed to. I've brought it up once before but never got a solution. My profile email is correct, and there's never anything in my spam folder. Perhaps you could investigate or get me pointed in the right direction. If I need to start a new topic/thread, just let me know.

  • Patrick
    • Support Monkey

    @Rone

    Glad I could help you get things fixed up for the widget. :slight_smile:

    As for the email notifications, we are working on it.

    Turns out it's a rather furtive little beast to track down, as it doesn't happen to everyone. Even some of the support staff are noticing the issue in their own feeds.

    Prepending a username with the @ symbol (like I did above) should also trigger an email. Did you get notification of this post?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.