WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
open gallery by click on featured image (8 posts)

  1. hypostudio
    Member
    Posted 2 years ago #

    hello

    I have a NextGen gallery at the end of some of my posts

    I'm adding featured image to the begin of post (by hack to template)

    I want to add a link (opening gallery from the end of post) to this featured image (if there is a gallery in post)
    thanks for any help

    hypo

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. ivdimova
    Member
    Posted 2 years ago #

    You want to add a link to the NextGen Gallery or to the featured image?

  3. hypostudio
    Member
    Posted 2 years ago #

    to featured image

  4. ivdimova
    Member
    Posted 2 years ago #

    <?php
    $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>
    <?php echo $url ?>
    try this one

  5. hypostudio
    Member
    Posted 2 years ago #

    this is great thx!
    it gives me back a url to NextGEN gallery (first image in gallery)

    is there a way how to check - if there is no gallery in post?
    as this script give (wrong) url to image also in post where no gallery is submitted

    thanks again

  6. ivdimova
    Member
    Posted 2 years ago #

    <?php   if ( has_post_thumbnail() ) {
    $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); }?>
    <?php echo $url ?>
    - this should work for you

  7. hypostudio
    Member
    Posted 2 years ago #

    ivdimova you are star! thx

    following your idea, here is my final script (if anyone need)

    it's adding featured image with link opening NextGEN gallery in post

    <?
    $attachments = get_children( array( 'post_parent' => $post->ID ) );
    $count = count( $attachments );

    if ( has_post_thumbnail() ) {
    $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
    if ($count > 1) { ?>

    <?
    }
    the_post_thumbnail(array(200,200));
    if ($count > 1) { ?>

    <?
    }
    }
    ?>

  8. ivdimova
    Member
    Posted 2 years ago #

    I am glad that you have found the solution

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic