Skip to content

Instantly share code, notes, and snippets.

@Willem-Siebe
Created July 17, 2014 17:43
Show Gist options
  • Save Willem-Siebe/90654e8fdf5513c13771 to your computer and use it in GitHub Desktop.
Save Willem-Siebe/90654e8fdf5513c13771 to your computer and use it in GitHub Desktop.
// Change sidebar widget values 'before' and 'after', see https://gist.github.com/Willem-Siebe/90654e8fdf5513c13771.
function wsis_modify_before_widget_after_widget($params) {
if ($params[0]['id']=='header-widgets-search') {
if (strpos($params[0]['before_widget'],'nav_menu-14')) {
//Supposing you want to change the HTML to <ul> instead of <div>
$params[0]['before_widget']='<nav id="nav_menu-14" class="wsis-widget widget_nav_menu">';
$params[0]['after_widget']='</nav>';
}
}
return $params;
}
add_filter('dynamic_sidebar_params','wsis_modify_before_widget_after_widget');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment