WordPress.org

Support

Support » How-To and Troubleshooting » Editing and Clicking Through Photo Galleries

Editing and Clicking Through Photo Galleries

Viewing 11 replies - 1 through 11 (of 11 total)
  • You have already been asken NOT to bump your posts and now your creating dupes? Stick to the original post, please.

    I’m not sure what you mean by “bump.” The original post was closed so I had to create a new one. I don’t know where to look or if there is any where to look to see what is coming in versions.

    Moderator Jan Dembowski

    @jdembowski

    Brute Squad and Volunteer Moderator

    Give this a read.

    http://codex.wordpress.org/Forum_Welcome#No_Bumping

    What you did was create a new topic to bring attention to your other one. Please do not do that. This topic like other duplicates is getting deleted. Duplicates make it harder to provide you with support.

    Moderator Jan Dembowski

    @jdembowski

    Brute Squad and Volunteer Moderator

    Nuts. That old topic was closed by the system. In that case please provide updated information i.e. WordPress version info, plugin version, etc.

    Current version. No plugins. Any theme there is, it has the same problem with any theme.

    esmi

    @esmi

    Forum Moderator

    I would suggest that you look for a suitable gallery plugin.

    Because they aren’t working on the built in gallery feature?

    Or is it just going to be a while still?

    esmi

    @esmi

    Forum Moderator

    There are no plans to add this to the default gallery as far as I know.

    Are they just planning to get rid of the gallery feature?

    I found a kind of goofy kind of work around to this if anybody else is in my boat and willing to settle for using a light box instead of an actual page for each photo that can be commented on, shared/liked/etc.

    But using the Fancybox lightbox script http://fancybox.net/ and the code below (pasted into your functions.php file), it will add the necessary “rel” to each thumbnail in your gallery and open each photo in a lightbox instead. For some reason Wodpress will be able to distinguish which photo is suppose to come next and they will click through properly this way.

    Though I’m still apprehensive about using this work around if WordPress isn’t planning on supporting the gallery function in the future.

    class WPFancyBox {
      // Constructor
      function WPFancyBox() {
        $urlpath = WP_PLUGIN_URL . '/' . basename(dirname(__FILE__));
    
        add_filter('wp_get_attachment_link', array(&$this,'add_rel'));
      }
    
      /*
       * Add rel="gallery-$id" to attachment links
       */
      function add_rel($link) {
        global $post;
        // a mild cheat. group by post id. the gallery_shortcode() $instance
        // static var would be better, but we can't get to it.
        $id = $post->ID; 
    
        // First, see if there's already a 'rel' attribute in the link:
        $atag = preg_match('#<a\s+(.*?)(rel=([\'"])(.*?)\3)(.*?)>(.*)#i', $link, $matches);
        if ($atag) {
          // Match found. Let's put Humpty Dumpty back together again:
          $quot = $matches[3];
          $relval = $quot . $matches[4] . " gallery-{$id}" . $quot;
          $before = $matches[1];
          $after = $matches[5];
          $rest = $matches[6];
          $link = "<a {$before}rel={$relval}{$after}>{$rest}";
        } else {
          $atag = preg_match('#<a\s+(.*?)>(.*)#i', $link, $matches);
          if ($atag) {
            // This is a much simpler reassembly
            $innards = $matches[1];
            $rest = $matches[2];
            $relval = "gallery-{$id}";
            $link = "<a {$innards} rel='lightbox'>{$rest}";
          }
        }
        return $link;
      }
    }
    
    function wpfb_init() {
      //global $wpfb;
    
      $wpfb = new WPFancyBox();
    }
    
    add_action('init', 'wpfb_init');
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Editing and Clicking Through Photo Galleries’ is closed to new replies.
Skip to toolbar