Custom excerpt length for Event+ plugin, with "..." ending

Hi all

In the Event+ plugin, please can you tell me how I can edit the excerpt length for the excerpt that is displayed in the sidebar widget?
Also, please can you tell me how to end it with "..." rather than it simply cutting a word in half?



P.S. I am running Wordpress 3.3.1 with a custom theme.

  • Kimberly


    Hi and Thanks for using WPMUdev forums :slight_smile:

    I found this

    1	add_action( 'dynamic_sidebar', 'my_set_excerpt_length' );
    3	function my_set_excerpt_length() {
    4	    add_filter( 'excerpt_length', 'my_new_excerpt_length' );
    5	}
    7	function my_new_excerpt_length( $length ) {
    8	    return 15;
    9	}

    But I admittedly am not sure where it goes, I believe function.php
    Its a snippet that is supposed to work for a custom excerpt length in wordpress sidebar

    Do you think this will help?



  • Robert

    Hi KimberleyL

    Thanks for the suggestion. I had tried that in functions.php but alas it did not work. I think it is because the plugin itself sets a custom excerpt length.

    So I've dived straight into the plugin files and in the Upcoming_Widget.php file, I have amended the line that reads:
    $excerpt = $_event->get_excerpt() ? $_event->get_excerpt() : substr(strip_tags($_event->get_content()), 0, 55);
    so that it now ends with 55. (the number of characters).
    I also then amended this line:
    <p><?php echo $excerpt; ?>...</p>
    by adding in the ellipsis as shown.

    This unfortunately:
    1. Still does not stop the excerpt from slicing a word in half; and
    2. means that I've hacked the plugin; so any updates to the plugin and it's gone.

    So it's a messy fix for now but that's what I needed, as I needed to fix the length of the excerpt so that I could style my sidebar correctly.

    If you can help me find a way to stop slicing the word and not have to hack the plugin I'd be much appreciated; especially if there's a way to do it without hacking the plugin.



  • aecnu

    Greetings Rob,

    Just checking if this issue was eventually resolved in another thread? Or by yourself separately to us? Or by us over email with you? Or using our live support?

    If so, no need to reply, that's great news.

    If not, or you have any more questions related to this thread, please feel free to post them below including any new symptoms or errors and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, happy days, glad you got it sorted :slight_smile:

    Thank you for being a WPMU Dev member!

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.