Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- This snippet will override placeholder #_EXCERPT which will
- limit the event details to 120 characters with read more link.
- */
- add_filter('em_event_output_placeholder','my_em_styles_placeholders',1,3);
- function my_em_styles_placeholders($replace, $EM_Event, $result){
- switch( $result ){
- case '#_EXCERPT':
- $maxchars = 120;
- $text = $replace;
- if(strlen($text) > $maxchars) {
- $text = substr($text, 0, $maxchars);
- $position = strrpos($text, " ");
- if($position > 0) {
- $text = substr($text, 0, $position);
- }
- return $text.'...<a href="'.$EM_Event->output('#_EVENTURL').'" class="eventreadmore">Read More...</a>';
- }
- break;
- }
- return $replace;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement