eventsmanager

custom excerpt

Sep 19th, 2013
298
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. This snippet will create new placeholder for event details excerpt with limits
  3. to any given characters which in this case 10.
  4. */
  5.  
  6. add_filter('em_event_output_placeholder','my_em_custom_excerpt_placeholders',1,3);
  7. function my_em_custom_excerpt_placeholders($replace, $EM_Event, $result){
  8. switch( $result ){
  9. case '#_CUSTOMEXCERPT':
  10. $replace = $EM_Event->output("#_EVENTEXCERPT");
  11. $replace = preg_replace('/<[^>]+./','', $replace);
  12. if($result == "#_CUSTOMEXCERPT"){
  13. if ( strlen($replace) > 10 ) {
  14. $length = 10;
  15. $replace = substr($replace,0,$length);
  16. }
  17. $replace = $replace . '... ';
  18. }
  19. break;
  20. }
  21. return $replace ;
  22. }
  23.  
  24. /*
  25. 2. use this custom placeholder in your default listing at Events > Settings > Formatting > Events > Default event list format
  26. */
  27.  
  28. => Default event list format header
  29.  
  30. <table cellpadding="0" cellspacing="0" class="events-table" >
  31. <thead>
  32. <tr>
  33. <th class="event-time" width="150">Date/Time</th>
  34. <th class="event-description" width="*">Event</th>
  35. <th class="event-description" width="*">Details</th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39.  
  40. => Default event list format
  41.  
  42. <tr>
  43. <td>
  44. #_EVENTDATES<br/>
  45. #_EVENTTIMES<br/>
  46. </td>
  47. <td>
  48. #_EVENTLINK
  49. {has_location}<br/><i>#_LOCATIONNAME, #_LOCATIONTOWN #_LOCATIONSTATE</i>{/has_location}
  50. </td>
  51. <td> #_CUSTOMEXCERPT </td>
  52. </tr>
  53.  
  54. => Default event list format footer
  55.  
  56. </tbody></table>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×