• Resolved whiteout

    (@whiteout)


    I’m building a tumblelog sort of theme and I attach only one image to each image post. I’d like to show that single <img /> in medium surrounded by an anchor linking to the full image.

    Doing something like:
    http://pastebin.com/f4ded7435
    outputs too much unnecessary code (<div>, <dt>, <dl>, and an extra <style>).

    I just want something like:
    http://pastebin.com/f6c9760f4
    Any ideas?

    [Sorry for the pastebin links, I can’t get code quoting to be behave on the WP forums.]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Why not just use the “Link to: Image” in the Add/Insert Media page?

    Thread Starter whiteout

    (@whiteout)

    I only have a 2.7.1 install to look at at the moment. Are you referring to “Insert into Post” in “Add an Image” > “Media Library”?

    Thread Starter whiteout

    (@whiteout)

    I have some classes that should be added to a couple of standard elements to each post. I want the these to be generated automatically. To do this I heavily rely on custom fields for most data. The gallery shortcode would fit in well with this.

    Are you referring to “Insert into Post” in “Add an Image” > “Media Library”?

    Yes. at that point, you should have the option to link a thumb or medium image in your post to either a full-sized raw image or a larger image within it’s own page.

    If you want to customise the gallery shortcode, I’d suggest copying the original gallery_shortcode() function from wp-includes/media.php, amending it, placing the amended function (called something like my_gallery_shortcode) in your theme’s functions.php file followed by:

    remove_shortcode( gallery_shortcode );
    add_shortcode('gallery', 'my_gallery_shortcode');

    That should replace the native gallery shortcode with your custom version.

    Thread Starter whiteout

    (@whiteout)

    How future proof would a solution like that be? Is there a chance it would break with the next WordPress version?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Gallery_Shortcode, output only one image’ is closed to new replies.