Support » Plugins » [Plugin: NextGEN Gallery] Link to Gallery from NG Gallery Widget Image?

  • I am using the nggallery widget to display one random image on a page. I managed to display the image’s title under the image through adding this code to widget.php:
    echo '<h2 style="text-align: center">'.$image->description.'</h2>';
    Now I’d like to also add a link to the image’s gallery. Is that at all possible?

    Thanks for any hints.

Viewing 9 replies - 1 through 9 (of 9 total)
  • [Plugin: NextGEN Gallery] Eureka! How to link to pages from sidebar gallery widget only (ad rotator) I guess that was a working version of what you and what I’m also looking for. Does not seem to work right anymore though. Maybe someone can get it working again.

    I’m lookin for the solution to link my sidebar slideshow widget to the gallery pages as well….

    Hope someone’s got a solution…

    alphadra0n: Your solution is nice, but not quite what we’re looking for, because the link should point to the gallery page related to the image. I wouldn’t want to type that in manually for each image…

    I was faced with a similar problem and solved it in 2 steps:

    1) by adding $this->pagelink = get_permalink( $gallery->pageid ); in image.php (~line 65)

    2) by changing the widget.php link-output in line 394 from $image->imageURL to $image->pagelink

    @doppelboxx Where would I find image.php? I’ve looked in throughout the Nextgen directory and can’t seem to find it. Keep in mind, I’m not using the most recent version of Nextgen plugin.

    Okay I see what Doppelboxx’s Code is doing, “2) by changing the widget.php link-output in line 394 from $image->imageURL to $image->pagelink” that changes the link from $image->imageURL to $image->pagelink.

    “1) by adding $this->pagelink = get_permalink( $gallery->pageid ); in image.php (~line 65”) and this Sets $image->pagelink to the $gallery->pageid.

    I’ve put the code where Doppelboxx said (image.php is in the folder of your theme,) set 1) does not seem to be functioning correctly. The links URL has been changed but it’s empty.

    I think the code from step 1) needs to be placed somewhere else but I’m not sure where.(I would guess in nggfunctions.php where the gallery function is?) Hopefully someone can help make sure its in the right place.

    I have the same problem:

    Is anybody able to solve it?

    Here is what I had to do. I was using a jquery vertical scrolling div to pull in pics from galleries on a portfolio site. Not using the sidebar widget. I wanted each thumbnail to link to the imagebrowser page for that image, where you could read notes about the pic or whatevs.

    Seemed simple enough…
    along with doppleboxx’s suggestion above, I also added:
    $this->pid = $gallery->pid;
    to image.php right after
    $this->pagelink = get_permalink( $gallery->pageid ); (doppleboxx’s suggestion)

    Then the link I wrote in my custom template gallery that pulls in the pics from gallery into a <ul> was like such:

    <a href="<?php bloginfo('url'); ?>/nggallery/page-<?php echo $image->pageid .'/page/'. $image->pid ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >

    I know. It’s a mouthful, but it works.

    I also had to create pages for each gallery and associate them in the nextgen gallery management screen, and activate permalinks both on the site and in the nextgen gallery options page.

    Here’s a breakdown of that link and what each thing is doing:

    <?php bloginfo('url'); ?> – Prints out the url of the site
    /nggallery/page- – Needed to be manually inserted to call for the imagebrowser instead of gallery page
    <?php echo $image->pageid . '/page/' . $image->pid ?> – as per Dopplboxx, prints the gallery page id – then interrupts the php and appends “/page/” to the url manually – then calls for the $pid (defined in image.php) which is the “picture id.”

    The rest was part of the default link so I left it alone – it’s mostly meta info.

    It was a tangled mess but in the end now I can show multiple galleries of thumbnails on a single page by calling for the gallery in the loop using <?php do_shortcode('[nggallery id=#]'); ?> and have each thumbnail link to it’s info page in the imagebrowser where all the meta is. With only Doppleboxx’s suggestion it took me to the gallery page and made user “click again” to get to the image info.

    Works great for portfolio sites.

    * The php that is printing out this link is ordinarily found on line 42 of gallery.php

    * Not sure where this happens in a widget, but I will look into it and if I figure it out I will post again.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: NextGEN Gallery] Link to Gallery from NG Gallery Widget Image?’ is closed to new replies.