Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9066

    Apologizes if my understanding of the theme is way off but I *think* I had a small problem getting piece of code for a Pinterest.com button to work because the theme doesn’t use traditional WP “featured images”.

    The slice of code in question is:

    Code:
    <?php $pinterestimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ ); ?>

    But it never pulls anything. Is it because of the theme-specific (or is it the Avia framework-specific?) way the post images are handled? I think it is looking for a call the theme never populates.

    What (if any) would be the Flashlight version of that piece of code?

    Thanks!

    #63337

    Hey,

    you can use the code I posted in this thread: http://www.kriesi.at/support/topic/make-images-of-galleries-appear-in-rss-readers#post-32903 – in this case it would look like:

    global $post;
    $id = avia_post_meta($post->post_id, 'gallery_image');
    $size = "full";
    $returnvalue = 'url';
    global $avia_config;

    if(!$id)
    {
    $attachment_holder = avia_get_post_by_title( "avia_smart-default-gallery");
    }
    else
    {
    $attachment_holder = avia_get_post_by_title( "avia_smart-gallery-of-post-".$id);
    }

    if(empty($attachment_holder['ID'])) return;

    $attachments = get_children(array('post_parent' => $attachment_holder['ID'],
    'post_status' => 'inherit',
    'post_type' => 'attachment',
    'post_mime_type' => 'image',
    'order' => 'ASC',
    'orderby' => 'menu_order ID'));

    if (!empty($attachments)){
    foreach($attachments as $key => $attachment)
    {
    $image_url_array[] = avia_image_by_id($attachment->ID, $avia_config['imgSize'][$size], $returnvalue);
    }
    }

    $postimage = "";

    if (!empty($image_url_array)){
    foreach($image_url_array as $url)
    {
    $postimage .= "<img src='$url' alt='feed image' title='feed image' />";
    }
    }

    $pinterestimage = $postimage;

    #63338

    Wow, that’s a lot of code to replace one line! :)

    I could not get it to work however. I’m putting it in the “if is single” portion of my loop-index but the results are the same, the media parameter is still empty.

    This is the pinterest code in full:

    Code:
    <?php $pinterestimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ ); ?>
    <X href=”http://pinterest.com/pin/create/button/?url=<?php echo urlencode(get_permalink($post->ID)); ?>&media=<?php echo $pinterestimage[0]; ?>&description=<?php the_title(); ?>” class=”pin-it-button” count-layout=”vertical”>Pin It</X>

    Again, the URL and Description are working but the media isn’t. Any ideas?

    Since the theme doesn’t have a featured image in posts, I’d be happy to just grab the first for this.

    Edit: Turned A tag to X because the forums were rendering it as link.

    #63339

    I think the problem is the post id then – do you get any output if you use following code:

    global $post;
    echo $post->post_id;

    #63340

    Do you mean adding “echo $post->post_id;” below the first line of your original code block? (If so, no difference)

    Example page (the share this area): http://glark.org/witness/

    #63341

    Ok, use the code I posted above an then try to replace:

    global $post;
    $id = avia_post_meta($post->post_id, 'gallery_image');

    with:

    $id = avia_post_meta(get_the_ID(), 'gallery_image');

    This should return the current post/page id.

    #63342

    Got it working! Thank you.

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

The topic ‘Pinterest button vs. Avia Framework?’ is closed to new replies.