SHARE
TWEET

custom placeholder for Recurrence date pattern

eventsmanager Jan 7th, 2017 169 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * The function below adds a placeholder to describe a recurrence pattern, or outputs nothing if event isn't a recurrence.
  4.  * For instructions on how to install this snippet, see here - http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
  5.  *
  6.  * @param string $replace
  7.  * @param EM_Event $EM_Event
  8.  * @param string $result
  9.  * @return string
  10.  */
  11. function my_em_event_recurrences_placeholder($replace, $EM_Event, $result){
  12.     if( $result == '#_EVENTRECURRENCEDATES' ){
  13.         $replace = '';
  14.         if( $EM_Event->is_recurrence() ){
  15.             $replace = $EM_Event->get_recurrence_description();
  16.         }
  17.     }
  18.     return $replace;
  19. }
  20. add_filter('em_event_output_placeholder','my_em_event_recurrences_placeholder',1,3);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top