Skip to content

Instantly share code, notes, and snippets.

@michaeluno
Created November 12, 2014 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaeluno/022ac686b40247686c9a to your computer and use it in GitHub Desktop.
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.
<?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