7

The default gallery structure of WordPress is really tortuous:

<div id="gallery-1" class="gallery...">
    <dl class="gallery-item">
        <dt class="gallery-icon">
            <a title="01Exam" href="bar">
                <img title="then my image" src="foo.jpg">
            </a>
        </dt>
    </dl>
</div>

Can you help me to output a simple list of images just like:

<ul class="gallery-item">
    <li>
        <img title="then my image" src="foo.jpg">
    <li>
</ul>
  • I found how to change default <dl> and <dt> using [gallery itemtag="div" icontag="span"] but not how to remove it. – rooofl Jun 18 '11 at 9:59
  • There's several related questions shown to the right(under the "Related" heading) that would of provided ample solutions to this question, just an FYI. – t31os Jun 19 '11 at 10:01
5

Use your own gallery shortcode handler - something like this in your functions.php:

function __my_gallery_shortcode( $attr )
{
     // render the gallery the way you want it
}
add_shortcode( 'gallery', '__my_gallery_shortcode' );

To get you started, you could just copy the code from the default handler gallery_shortcode(), and edit as you require.

  • Sadly there's really no better way to do this... – kaiser Jun 18 '11 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.