Last active
February 18, 2017 14:18
-
-
Save nielslange/6627e6497e2b6e2c55ca0dbd0892e33b to your computer and use it in GitHub Desktop.
Add link shortcode to widget title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Add link shortcode to widget title | |
//* Usage: [link href = https://www.google.com]Google[link] | |
add_filter( 'widget_title', 'link_widget_title' ); | |
function link_widget_title( $title ) { | |
$title = str_replace( '[link', '<a', $title ); | |
$title = str_replace( '[/link]', '</a>', $title ); | |
$title = str_replace( ']', '>', $title ); | |
return $title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment