WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: NextGEN Gallery] Link to Gallery from NG Gallery Widget Image? (10 posts)

  1. alexemde
    Member
    Posted 5 years ago #

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

  2. alphadra0n
    Member
    Posted 5 years ago #

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

  3. zonk675
    Member
    Posted 5 years ago #

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

    Hope someone's got a solution...

  4. alexemde
    Member
    Posted 5 years ago #

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

  5. doppelboxx
    Member
    Posted 5 years ago #

    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

  6. nathanegriffin
    Member
    Posted 5 years ago #

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

  7. alphadra0n
    Member
    Posted 5 years ago #

    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.

  8. Sa1boT
    Member
    Posted 4 years ago #

    I have the same problem:
    http://wordpress.org/support/topic/269486?replies=3#post-1082532

    Is anybody able to solve it?

  9. psperkins
    Member
    Posted 4 years ago #

    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.

  10. psperkins
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.