Skip to content

Instantly share code, notes, and snippets.

@ilicfilip
Created February 18, 2020 08:17
Show Gist options
  • Save ilicfilip/59ee8e08fb662b2e1a57a944e130d643 to your computer and use it in GitHub Desktop.
Save ilicfilip/59ee8e08fb662b2e1a57a944e130d643 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Remove Widget Titles
Plugin URI: http://scratch99.com/wordpress/plugins/remove-widget-titles/
Description: Removes the title from any widget that has a title starting with the "!" character.
Version: 1.0
Date: 23 November 2011
Author: Stephen Cronin
Author URI: http://www.scratch99.com/
Copyright 2011 Stephen Cronin (email: sjc@scratch99.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Add the filter and function, returning the widget title only if the first character is not "!"
add_filter( 'widget_title', 'remove_widget_title' );
function remove_widget_title( $widget_title ) {
if ( substr ( $widget_title, 0, 1 ) == '!' )
return;
else
return ( $widget_title );
}
// What, you were expecting more?
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment