In the function EM_Object::output_excerpt (in wp-content/events-manager/classes/em-object.php) it’s calling wp_trim_words which strips all the html tags. This function needs to be rewritten. Here’s a guide on how to output excerpts: https://stackoverflow.com/questions/24151161/how-to-prevent-wordpress-from-stripping-html-tags-in-excerpt#answer-24160854
Hopefully the plugin author will fix this.
Meanwhile you can fix this by overriding the event excerpt placeholders by adding the following code snippet:
function my_output_excerpt($excerpt_length, $excerpt_more, $is_event_cut ) {
$post = get_post(get_the_ID());
if (!empty($post->post_excerpt))
$replace = $post->post_excerpt;
else
$replace = $post->post_content;
if( empty($this->post_excerpt) || $cut_excerpt ){
if ( preg_match('/<!--more(.*?)?-->/', $replace, $matches) ) {
$content = explode($matches[0], $replace, 2);
$replace = force_balance_tags($content[0]);
}
if( !empty($excerpt_length) ){
//shorten content by supplied number
$replace = strip_shortcodes( $replace );
$replace = str_replace(']]>', ']]>', $replace);
// replace the following line with something that doesn't strip tags
// $replace = wp_trim_words( $replace, $excerpt_length, $excerpt_more );
}
}
return $replace;
}
add_filter('em_event_output_placeholder','my_em_styles_placeholders',10,3);
function my_em_styles_placeholders($replace, $EM_Event, $result){
if( preg_match( '/#_EVENTEXCERPT.*/', $result ) ) {
if( !empty($this->post_excerpt) && $result != "#_EVENTEXCERPTCUT" ){
$replace = $this->post_excerpt;
}else{
$excerpt_length = ( $result == "#_EVENTEXCERPTCUT" ) ? 55:false;
$excerpt_more = apply_filters('em_excerpt_more', ' ' . '[...]');
if( !empty($placeholders[3][$key]) ){
$ph_args = explode(',', $placeholders[3][$key]);
if( is_numeric($ph_args[0]) || empty($ph_args[0]) ) $excerpt_length = $ph_args[0];
if( !empty($ph_args[1]) ) $excerpt_more = $ph_args[1];
}
$replace = my_output_excerpt($excerpt_length, $excerpt_more, $result == "#_EVENTEXCERPTCUT");
}
}
return $replace;
}
I’ll leave the completion of the function my_output_excerpt as an excercise for the reader.
You can add the code snippet using the Code Snippets plugin.
-
This reply was modified 1 year, 5 months ago by
joneiseman.