Last active
February 22, 2017 15:54
-
-
Save Pebblo/d80ea24588fdc02ea21692aef89704d9 to your computer and use it in GitHub Desktop.
Example of how you can alter the description used in the calendar tooltips to allow HTML tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Please do not include the opening php tag if you have one. | |
function tw_ee_enable_tags_in_calendar_tooltip( $description, $datetime_in_calendar ){ | |
$event = $datetime_in_calendar->event(); | |
if( $event instanceof EE_Event ){ | |
$description = $event->short_description( 55, NULL, TRUE ); | |
if ( empty( $description )) { | |
$description = $event->description_filtered(); | |
// better more tag detection (stolen from WP core) | |
if ( preg_match( '/<!--more(.*?)?-->/', $description, $matches ) ) { | |
$description = explode( $matches[0], $description, 2 ); | |
$description = array_shift( $description ); | |
$description = strip_tags( $description,'<em><p><br><strong>' ); | |
} | |
} | |
$description = do_shortcode( $description ); | |
} | |
return $description; | |
} | |
add_filter('FHEE__EE_Datetime_In_Calendar__to_array_for_json__description', 'tw_ee_enable_tags_in_calendar_tooltip', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reference:
https://eventespresso.com/topic/html-in-calendar-tooltip/