Skip to content

Instantly share code, notes, and snippets.

@nandaleite
Created December 8, 2017 04:03
Show Gist options
  • Select an option

  • Save nandaleite/6fbce8a549b7f93e4c76180ff581c21b to your computer and use it in GitHub Desktop.

Select an option

Save nandaleite/6fbce8a549b7f93e4c76180ff581c21b to your computer and use it in GitHub Desktop.
// You can filter the title of most widgets and change the markup. The name of the filter is 'widget_title' and the third parameter tells you the type of the filtered widget.
add_filter( 'widget_title', 'wpse_52108_nav_widget_title_link', 30, 3 );
/**
* Changes the title for the nav menu widget.
*
* @param string $title
* @param string $instance
* @param string $id_base
* @return string
*/
function wpse_52108_nav_widget_title_link( $title, $instance = NULL, $id_base = '' )
{
return 'nav_menu' === $id_base ? "<a href='http://example.com'>$title</a>" : $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment