Viewing 7 replies - 1 through 7 (of 7 total)
  • You want to add a link to the NextGen Gallery or to the featured image?

    Thread Starter hypostudio

    (@hypostudio)

    to featured image

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

    try this one

    Thread Starter hypostudio

    (@hypostudio)

    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

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

    – this should work for you

    Thread Starter hypostudio

    (@hypostudio)

    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) { ?>

    <?
    }
    }
    ?>

    I am glad that you have found the solution

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: NextGEN Gallery] open gallery by click on featured image’ is closed to new replies.