How can we improve WooThemes?

Make prettyPhoto lightbox work with wordpress > 3.5 gallery

When you activate PrettyPhoto lighbox script under "Dynamic Images > Thumbnail Settings" it does not work on WP 3.5 image galleries. It would be great if you could fix that, otherwise one needs to install an additional lightbox scripts which bloats up the website.

40 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    JanJan shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    4 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Iggy PritzkerIggy Pritzker commented  ·   ·  Flag as inappropriate

        Updated for latest woocommerce:

        /* add to galleries */
        function prettyaddgallery ($content) {
        global $post;
        $content = preg_replace("/<a/","<a data-rel=\"prettyPhoto[$post->ID]\"",$content,1);
        return $content;
        }
        add_filter( 'wp_get_attachment_link', 'prettyaddgallery');

      • Josh CarrJosh Carr commented  ·   ·  Flag as inappropriate

        Nick - it's a bit late - but this can be added into your functions.php file:

        <code>
        add_filter( 'wp_get_attachment_link', 'prettyaddgallery');

        function prettyaddgallery ($content) {
        $content = preg_replace("/<a/","<a rel=\"lightbox[gallery]\"",$content,1);
        return $content;
        }
        </code>

        That will add the lightbox to the gallery images.

      • Tim GriffinTim Griffin commented  ·   ·  Flag as inappropriate

        I like this idea. The option would be quite nice. A filter in the functions.php can already make that happen - but a nice checkbox would be nice!

      Feedback and Knowledge Base