daily pastebin goal
20%
SHARE
TWEET

Modify event link (make it linkable)

BakerMan Dec 9th, 2013 112 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. // Change links for event, venue and organizer websites so
  2. // that they read 'Visit website' rather than exposing the
  3. // actual URL itself
  4.  
  5. function modify_event_link( $link ) {
  6.         return replace_link_text( $link, 'Visit website', 'No website' );
  7. }
  8.  
  9. function replace_link_text( $link, $replacement_text, $failure_text ) {
  10.         if ( empty( $link) ) return $failure_text;
  11.         if ( false === ( $inner_starts = strpos($link, '>') ) ) return $failure_text;
  12.         if (false === ( $inner_ends = strpos( $link, '<', ++$inner_starts ) ) ) return $failure_text;
  13.         return substr_replace($link, $replacement_text, $inner_starts, $inner_ends - $inner_starts);
  14. }
  15.  
  16. add_filter( 'tribe_get_event_website_link', 'modify_event_link' );
  17. add_filter( 'tribe_get_organizer_website_link', 'modify_event_link' );
  18. add_filter( 'tribe_get_venue_website_link', 'modify_event_link' );
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