WordPress.org

Ready to get started?Download WordPress

Forums

Editing and Clicking Through Photo Galleries (12 posts)

  1. alanchrishughes
    Member
    Posted 6 months ago #

    Does anybody know if there is a fix in the works for photo galleries?

    http://wordpress.org/support/topic/add-a-photo-to-photo-gallery?replies=4

    The design of a new site I've been working on has been on hold for quite a while now depending on whether it will be able to use the built in gallery feature or not and I don't know if I should just give up and build a new design or hold out another month or two if it's going to be fixed.

  2. Media X
    Member
    Posted 6 months ago #

    You have already been asken NOT to bump your posts and now your creating dupes? Stick to the original post, please.

  3. alanchrishughes
    Member
    Posted 6 months ago #

    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.

  4. 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.

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

  6. alanchrishughes
    Member
    Posted 6 months ago #

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

  7. esmi
    Theme Diva & Forum Moderator
    Posted 6 months ago #

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

  8. alanchrishughes
    Member
    Posted 6 months ago #

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

  9. alanchrishughes
    Member
    Posted 6 months ago #

    Or is it just going to be a while still?

  10. esmi
    Theme Diva & Forum Moderator
    Posted 6 months ago #

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

  11. alanchrishughes
    Member
    Posted 6 months ago #

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

  12. alanchrishughes
    Member
    Posted 6 months ago #

    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');

Reply

You must log in to post.

About this Topic

Tags

No tags yet.