This WordPress plugin moves the gallery shortcode styles to the head so it doesn’t break XHTML validation; also allows disabling or modifying the default gallery styles.
By default when using the WordPress gallery, the styles are placed into the post content which breaks XHTML validation. This plugin moves the style into the head of the page using a look-ahead to determine if the shortcode is used in any posts.
This plugin also gives you the option to modify the default gallery style CSS or disable the gallery styles entirely (so you can control it from your template CSS files).
This plugin uses ideas recommended in a patch located at:
http://trac.wordpress.org/attachment/ticket/6380/6380-style.diff
Special thanks to the original author of this plugin, Matt Martz, http://sivel.net.
Version Information
Version: 2.3
Requires WordPress Version: 3.0
Compatible up to: 3.5
Last updated: March 8, 2013
License: GNU General Public License (GPL) Version 2
Installation
Installation is just like any other WordPress plugin:
- Upload the ‘gallery-shortcode-style-to-head’ folder to the ‘/wp-content/plugins/’ directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
Immediately after installation, your galleries should pass W3C XHTML validation. You can make further adjustments under Admin > Settings > Media.
Frequently Asked Questions
How do I make the WP galleries XHTML compliant?
- Just activate the plugin. Nothing else is required.
How do I adjust the default gallery CSS styles?
- In WP admin, go to Settings > Media.
- Scroll down to “Modify gallery CSS style.’”
- Adjust to your liking!
- Click “Save Changes.”
How do I disable the CSS styles (so I can control the CSS in my template)?
- In WP admin, go to Settings > Media.
- Scroll down to “Disable gallery CSS in ‘head.’”
- Check the box.
- Click “Save Changes.”
How do I reset the gallery CSS styles to default?
- In WP admin, go to Settings > Media.
- Un-check the setting for “Disable gallery CSS in ‘head’.”
- Clear everything in the “Modify gallery CSS style” text field (so it’s totally empty).
- Click “Save Changes.” The styles will be reset to default.
Download
Support
Please contact me with any support requests or bug reports. Thank you!





