Advertisement
vapvarun

Insert icon in search autocomplete: Global BuddyPress search

Dec 31st, 2016
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. /**
  2.  * Insert icon in search autocomplete
  3.  */
  4. function cpt_add_icon( $html, $type, $url, $type_label ) {
  5.  $category_search_url = esc_url( add_query_arg( array( 'subset' => $type ), $url ) );
  6.  $icon = '<i class="fa fa-gg-circle" aria-hidden="true"></i>';
  7.  
  8.  if ( $type == 'forum' ) {
  9.  $html = "<span>" . $icon . "<a href='" . esc_url( $category_search_url ) . "'>" . $type_label . "</a></span>";
  10.  }
  11.  
  12.  return $html;
  13. }
  14.  
  15.  
  16. add_filter( 'buddypress_gs_autocomplete_category', 'cpt_add_icon', 10, 4 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement