Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Cristian Antohe

    (@sareiodata)

    Just replace the foreach with this:

    foreach( $imgproduto as $imgproduto){
    
    	$attachment_image = wp_get_attachment_image_src($imgproduto['imagem-produto'], 'medium');
    	$attachment_fullimage = wp_get_attachment_image_src($imgproduto['imagem-produto'], 'full');
    
    	echo '<div id="img-produto"><a href=".$attachment_fullimage[0]."><img src="'. $attachment_image[0].'"/></a></div>';
    
    }

    You’re basically creating a link that takes you to the full image size.

    Thread Starter Pedromrferreira

    (@pedromrferreira)

    Allright ??

    Just made a correction to your code:
    ‘.$attachment_fullimage[0].’ (quotation marks where missing)

    Thanks!!!

    Thread Starter Pedromrferreira

    (@pedromrferreira)

    There′s another thing, I want link the image to the post, I’m using this code, it shows the link of the post in top of the image. Here’s the code:

    <?php
    $imgproduto1 = get_post_meta( $post->ID, 'imgproduto1', true );
    foreach( $imgproduto1 as $imgproduto1){
    									$attachment_image = wp_get_attachment_image_src($imgproduto1['imagem-produto1'], 'thumbnail');
    									echo '<div id="img-produto"><a href="'.the_permalink().'"><img src="'. $attachment_image[0].'"/></a></div>';
    }
    
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Image’ is closed to new replies.