dyadica.net

Fun and Games in the Dyadic Sea

Wordpress Gallery CSS

permalink image comments image
Tuesday, 27 January '09 :

Time for another wordpress mod driven by the ongoing ps-wii-elite theme revamp:

Since the advent of wordpress 2.5 the built in gallery system has a habit of deploying a “nice” chunk of bespoke css slap bang in the middle of your web page, where it cannot be reached/styled by normal methods.

Many folks have developed plugins to remedy this factor however I prefer to remove it completely, time for another wordpress hack:

wp-includes>media.php  contains the evil code around line 641, detailed as follows:

$output = apply_filters('gallery_style', "
<style type='text/css'>
.gallery {
margin: auto;
}
.gallery-item {
float: left;
margin-top: 10px;
text-align: center;
width: {$itemwidth}%;}
.gallery img {
border: 2px solid #cfcfcf;
}
.gallery-caption {
margin-left: 0;
}
</style>
<!-- see gallery_shortcode() in wp-includes/media.php -->
<div class='gallery'>");

Simply edit this to equal the following, thus removing the css:

$output = apply_filters('gallery_style', "
<!-- see gallery_shortcode() in wp-includes/media.php -->
<div class='gallery'>");

The gallery can now be styled in the usual manner using the following definitions:

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

Simple eh.. I have left things pretty raw at this stage as I am planning to add some thickbox deffinition functionality at this point.  This was another Wordpress hack brought to you by dyadica.net.

Tags: , , ,

page meta

get trackback image get trackback image
details
  • Posted: Tuesday, 27 January '09
  • Edited: Tuesday, 27 January '09
  • Category: Web, css, wordpress
  • Author: admin

say what do you think

RSS feed | Trackback URI

css | xhtml | dyadica.net © admin 2010 | powered: wordpress | fuel: ps-wii-elite | top | sign-up