• Resolved ashsplash

    (@ashsplash)


    Hi everyone,

    I’m loving the WP gallery feature that was added in v2.5 however I have a problem that I do hope will be easy for someone to answer.

    I have a page where I have a number of images in the gallery, this page also has a custom template. I want to display the images in a very particular way to the end user however can’t seem to find a way to override the default gallery HTML.

    What would be perfect would be a PHP array of all the images and their captions etc so that I can manipulate them as the design requires.

    Thanks for your help.

Viewing 1 replies (of 1 total)
  • Thread Starter ashsplash

    (@ashsplash)

    I’ve managed to solve this with regex, certainly not the best solutions but does what it needs to.

    For those that need it add the following to your template and manipulate the $images array until you’ve got the data you need.

    $gallery = do_shortcode('[gallery link="file"]');
    $images = array();
    preg_match_all('|<a.*?href\s*=\s*["](.*?)["].*?>(.*?)</a>|i', $gallery, $images);
    array_shift($images);
Viewing 1 replies (of 1 total)
  • The topic ‘Gallery feature in 2.5 – get array of images’ is closed to new replies.