Created
November 12, 2014 22:10
-
-
Save michaeluno/022ac686b40247686c9a to your computer and use it in GitHub Desktop.
A small WordPress plugin that modifies the title tag of the Fetch Tweets plugin widgets.
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 | |
/** | |
* Plugin Name: Fetch Tweets - Modify Widget Title Tag | |
* Plugin URI: http://en.michaeluno.jp/ | |
* Description: Modifies the title tag of the Fetch Tweets plugin widgets. | |
* Author: Michael Uno | |
* Author URI: http://michaeluno.jp | |
* Version: 1.0.0 | |
*/ | |
function fetch_tweets_modify_widget_title_tag( $aParams ) { | |
if ( ! isset( $aParams[ 0 ] ) ) { | |
return $aParams; | |
} | |
$_aWidgetParams = $aParams[ 0 ]; | |
if ( ! isset( $_aWidgetParams['widget_id'] ) ) { | |
return $_aWidgetParams; | |
} | |
if ( ! preg_match( "/^fetch_tweets_widget_/", $_aWidgetParams['widget_id'] ) ) { | |
return $aParams; | |
} | |
$_aWidgetParams['before_title'] = '<h2 class="your-class-selector">'; | |
$_aWidgetParams['after_title'] = '</h2>'; | |
$aParams[ 0 ] = $_aWidgetParams; | |
return $aParams; | |
} | |
add_filter( "dynamic_sidebar_params", 'fetch_tweets_modify_widget_title_tag' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment