SHARE
TWEET

Filter Bar: string filter (remove elements)

BakerMan Mar 28th, 2014 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter( 'tribe_get_template_part_content', 'modify_filterbar_output', 10, 5 );
  2.  
  3. /**
  4.  * We'll use some string manipulation to tweak filter bar output.
  5.  *
  6.  * Subsequent releases of Filter Bar may contain additional hooks that allow a finer
  7.  * grained approach to this problem.
  8.  *
  9.  * @param $html
  10.  * @param $template
  11.  * @param $file
  12.  * @param $slug
  13.  * @param $name
  14.  * @return string
  15.  */
  16. function modify_filterbar_output( $html, $template, $file, $slug, $name ) {
  17.         // Only interfere if this relates to the horizontal filter bar
  18.         // (you can change appropriately if you are interested in the vertical form)
  19.         if ( 'filter-bar/filter-view-horizontal' !== $slug ) return $html;
  20.  
  21.         // In this case we want to eliminate the "all day" entry in the time filter
  22.         // (you could similarly adapt this to remove different elements)
  23.         $eliminate = '<li><label><input type="checkbox" value="allday"  name="tribe_timeofday[]"  /><span title="All Day">All Day</span></label></li>';
  24.         return str_replace( $eliminate, '', $html );
  25. }
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