• Halloe!

    I’ve installed NextGen Gallery, and have disabled all effects and viewers so that each image is displayed Old Skool style on the page, so that users can link directly to an image.

    I have a problem though with the plugins Yoast Breadcrumbs and Sociable bookmarking, in that they don’t pick up the querystring defining the album, gallery or image. This means that with Sociable that users can’t bookmark an individual image.

    I tried using permalinks to no avail (which also brought up a 404 on image pages within a gallery in an album).
    The “Deactivate gallery page link” doesn’t seem to do much either, apart from stop my galleries within an album from loading.

    Am I getting something obvious wrong here?
    Any assistance would be very much appreciated. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter grumbirky

    (@grumbirky)

    I think I’ve solved one bit of my problem, with Sociable, so if anyone wants to know how, I hacked the sociable.php file a bit:

    Just after the line:
    $permalink = urlencode(get_permalink($post->ID));

    I put this:
    if ( isset($_GET[‘pid’]) ) {
    $pid = attribute_escape($_GET[‘pid’]);
    $permalink = $permalink . “?pid=” . $pid;
    }

    Not sure if it’s the best way to do it, but it seems to have done the trick. Obviously this won’t work though if you have the permalinks turned on in NextGen.
    The Yoast plugin might be a bit over my head though. Still, it’s a start.

    Thread Starter grumbirky

    (@grumbirky)

    Halloe?

    I think I’ve worked a little hack for Yoast to pick up the name of the image, on the image page. As above, I’m not sure if it’s the best way, but here goes, near the end of yoast-breadcrumbs.php before the prefix and suffix code, I’ve inserted another if in between if (!$link[‘cur’]) and else:

    $output = $homelink;
    foreach ( $links as $link ) {
    $output .= ‘ ‘.$opt[‘sep’].’ ‘;
    if (!$link[‘cur’]) {
    $output .= ‘‘.$link[‘title’].’‘;
    } else if ( isset($_GET[‘pid’]) ) {
    // Birks addition to get image page id 17/03/10
    $pid = attribute_escape($_GET[‘pid’]);
    global $wpdb; $nextgenpictitle = $wpdb->get_var($wpdb->prepare(“SELECT alttext FROM wp_ngg_pictures WHERE pid = %d”,$pid));
    $output .= ‘‘.$link[‘title’].’ ‘.$opt[‘sep’].’ ‘. $nextgenpictitle;
    } else {
    $output .= bold_or_not($link[‘title’]);
    }
    }

    This makes the gallery page a link too, completing the proper path and that.

    Ideally I would have preferred not to have had to hack these other plugins, as it will make upgrading them a pain, but at least it works until a better way comes along..

    So here is a brute force solution for what you want to do. It’s not terrible elegant, and won’t work for nested albums, but it works:

    In view/gallery.php, right ABOVE the <div class=”ngg-galleryoverview”>, place thhis:

    <!--breadcrumbs go here-->
    You are here: <a href="../../../../">Home</a> > <a href="../../../../photography">Photo Gallery</a> > <strong><a href="<?php echo $gallery->pagelink ?>"><?php echo $gallery->title ?></a></strong>

    You will need to change the (photography) and (../../..) structures to match your permalinks, but you get the gist…

    Thread Starter grumbirky

    (@grumbirky)

    Thanks nicksmarto, but I started playing around with the native gallery, which works fine out of the box with Yoast and Sociable.
    Shame that it doesn’t have the all the features of NextGen, such as albums and pagination and such.

    Arrg.

    grumbirky, when you said in your original message – “each image is displayed Old Skool style on the page, so that users can link directly to an image” how did you manage to make it so that each image had its own link and was still appearing in the template? I need to find a way to make it so that every individual image in the gallery has its own permalink and when i disable all the display options the image just loads by itself in a blank page

    Thread Starter grumbirky

    (@grumbirky)

    bw1984, I think I got it by checking the Show ImageBrowser option under the Gallery tab in Gallery Settings.
    You might need to deactivate the ‘Deactivate gallery page link’ option too.

    Good luck!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘NextGen Gallery – Links to individual images not picked up by other plugins’ is closed to new replies.