[wp-testers] Gallery CSS/xHTML

Andy Skelton skeltoac at gmail.com
Fri Mar 28 01:57:42 GMT 2008


On Thu, Mar 27, 2008 at 7:11 PM, Spencer Lavery <phobea at gmail.com> wrote:
> The CSS and xHTML should be part of the 'Default' theme, or any theme
>  for that matter - injecting them within the post not only forces users
>  to edit the core files in order to change their appearance, but it's
>  also adding <style> tags, and inline CSS (<br style="clear:all;">)
>  which is breaking validation.

Last night I uploaded a patch to move the style tag to wp_head.

Talking with Matt last night, we opted to keep them out of default and
classic because the galleries are supposed to work with existing
themes. Themes designed or updated with 2.5 galleries in mind can
override our CSS in several ways: greater specificity of selectors,
!important, or (my favorite) remove_action().

>  Instead of forcing each image to be wrapped in a DL, add some new WP
>  template tags for targeting the gallery specifically inside the loop,
>  for example:
>
>  <?php if (have_gallery()) : ?>
>  <dl class="gallery">
>  <?php while (have gallery()) : the_gallery(); ?>
>  <dt><?php the_thumbnail(); ?>
>  <?php endwhile; ?>
>  <?php endif; ?>

This won't happen. Themes can register their own gallery shortcode
handlers. As above, galleries need to work with existing themes.
Waiting for them to add template tags is not an option. Not only that,
but a gallery shortcode can be placed anywhere in the post. It doesn't
make much sense for us to remove something from the_content and place
it outside the post. Plugins and themes are welcome to do that.

The good news---always look on the bright side---is that a theme can
override the entire set of gallery handling functions by registering
their own gallery shortcode handler.

>  This could allow themers to pass variables such as thumbnail size
>  directly into the template tag, i.e:
>
>  <?php the_thumbnail('width=120&height=120&crop=1'); ?>

Themes don't get the final word on this. The post author can put
parameters into the shortcode. I can see allowing themes to filter the
defaults, so I added a gallery_defaults filter to my patch.

>  I apologise if this is already in production, I just feel that the new
>  Gallery is such an awesome feature that it deserves to be easier to
>  use, and easier to work with for themers and standard users alike.

I'm glad you like it. Your feedback just made it better. :-)

Cheers,
Andy


More information about the wp-testers mailing list