20 Feb 2009

Remove WordPress [gallery] shortcode embedded CSS

Dump this code anywhere in Theme’s template functions.php file (For example, functions.php file for a Theme named “default” would probably reside in the directory wp-content/themes/default/functions.php):

add_filter('gallery_style',
	create_function(
		'$css',
		'return preg_replace("#<style type=\'text/css\'>(.*?)</style>#s", "", $css);'
		)
	);

And these are the classes for your stylesheet:

.gallery {}
.gallery-item {}
.gallery-icon {}
.gallery-caption {}

Comments RSS feed

Leave a Reply

You can use these tags: <a href="" title=""> <ol> <ul> <li> <strong> <em> <pre> <code> <blockquote cite="">