Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #3173

    I understand if you are not able to help but I hope this is a easy question.

    When looking at a gallery, on an individual image for example, I want to have a link next to the image name that passes the URL of the full image to an ecard system I have, making it so that basically members can send an ecard of images they look at in the gallery.

    So I looked at the code and it seems the part I need to customize is in js/prettyphoto/js/jquery.prettyphoto.js

    The problem is that even looking at the prettyphoto site I have no idea what php code I could add in between like 10 and 47 so that I could simply have a link that would go to (for example) for example.

    I can change line 26 to say

    <div class="pp_details clearfix"> <a href="#">Send this image as an eCard</a>

    but I don t know what I should put in the # for the href. Is that a dynamic hidden value for each image like $photourl for example?

    Any direction would really be cool. Thanks in advance



    you can use the image attachment function: to achieve what you want.


    Thanks, I looked into that but I can t add that to the .js since it won’t be executed. Do you know where I could add <?php wp_get_attachment_link($id, $size, $permalink, $icon, $text); ?> at the bottom of all images when they are showing in the poped’ up gallery?

    EDIT: Would it be easier to disable the prettyphoto code and use the wp-prettyphoto plugin instead?

    Any help is appreciated since at the moment I am stuck with only being able to look at the jquery.prettyPhoto.js and I am not sure where else to make changes


    Ok instead of trying to modify the pretty photo code… how about instead having a link below each image in the gallery before one clicks on an image…that should be easier to manage right?

    So how would I go if I wanted to have a link that would go to another file and pass the url of the image. Any help is very much appreciated…I know you guys are busy fixing the themes for 3.1 so this is not critical but I would appreciate some help.

    Also this could be helpful for people who want to provide a way to download the images since the prettyphoto gallery does not allow that



    you can modify kriesi_post_thumb.php located under frameworkhelper_functions

    At the very bottom you’ll find following code:

    $defaultimage = $linkwrap[0]."<img ".$img_attr_string." src='".$image_URL."' alt='' title='".get_the_title()."' height='".$option['wh']['height'] ." ' width='".$option['wh']['width'] ."' />".$linkwrap[1];

    You could append the linkwrap arrays with a download text like:

    $defaultimage = $linkwrap[0]."<img ".$img_attr_string." src='".$image_URL."' alt='' title='".get_the_title()."' height='".$option['wh']['height'] ." ' width='".$option['wh']['width'] ."' />".$linkwrap[1]."<br/>".$linkwrap[0]."Click here to download the image".$linkwrap[1];


    Thank you so much for the response but it is not showing. I tested this on 3.0 and 3.1 internally… I tried to add other codes to the original line but it is not showing. Are you sure this is the right place or that it is not overwritten by another part?

    EDIT: Oh Wait, this is for the hompage featured image and not for the gallery, I just noticed it added the link on the homepage below the featured images. I need it under the gallery images.

    I think the gallery display is controlled by /wp-includes/media.php


    I’m sorry but I must drop the ball here. I don’t know a quick solution. I think you need to adjust following code in media.php:

    <!-- see gallery_shortcode() in wp-includes/media.php -->";
    $size_class = sanitize_html_class( $size );
    $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
    $output = apply_filters( 'gallery_style', $gallery_style . "ntt" . $gallery_div );

    $i = 0;
    foreach ( $attachments as $id => $attachment ) {
    $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);

    $output .= "<{$itemtag} class='gallery-item'>";
    $output .= "
    <{$icontag} class='gallery-icon'>
    if ( $captiontag && trim($attachment->post_excerpt) ) {
    $output .= "
    <{$captiontag} class='wp-caption-text gallery-caption'>
    " . wptexturize($attachment->post_excerpt) . "
    $output .= "</{$itemtag}>";
    if ( $columns > 0 && ++$i % $columns == 0 )
    $output .= '<br style="clear: both" />';

    $output .= "
    <br style='clear: both;' />

    return $output;

    but I’m not sure….


    yeah I knew it was that file but I had spent 4 hours trying variations and finally realized that the WP code needed was wp_get_attachment_url and like an ass for hours I was trying to make it work with wp_get_attachment_link. This worked:

    $lien = wp_get_attachment_url( $id );
    $output .= "<li><a href=/cards/index.php?=".$lien.">Send as an Ecard</a><{$itemtag} class='gallery-item'>";
    $output .= "<{$icontag} class='gallery-icon'>$link";
    $output .= "</{$icontag}>";
    $output .= "</{$itemtag}></li>";


    Thanks for sharing the code :)

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Prettyphoto Question’ is closed to new replies.