WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Please & Thank You - Image Links Not Working in 3.5 (3 posts)

  1. luisbonie
    Member
    Posted 1 year ago #

    Ok, as you might know when I updated to 3.5 I noticed that I can not link images anymore :( So am using the "WP Gallery Custom Links" plugin to place a link for my images... Problem is that am not needing it in the post or page, I need the product thumbnail under my featured image for my product page to link out and not to the image...

    Here is a screen shot...

    THANKS!

  2. luisbonie
    Member
    Posted 1 year ago #

    This is the field that I would like the thumbnail to use "attachments-262-gallery_link_url" but am not sure how to write it in the "wp_get_attachment_url( $attachment->ID )"

    am I going about this the right way?

    <?php
    global $post, $woocommerce;
    ?>
    <div class="thumbnails"><?php
    	$attachments = get_posts( array(
    		'post_type' 	=> 'attachment',
    		'numberposts' 	=> -1,
    		'post_status' 	=> null,
    		'post_parent' 	=> $post->ID,
    		'post__not_in'	=> array( get_post_thumbnail_id() ),
    		'post_mime_type'=> 'image',
    		'orderby'		=> 'menu_order',
    		'order'			=> 'ASC'
    	) );
    	if ($attachments) {
    
    		$loop = 0;
    		$columns = apply_filters( 'woocommerce_product_thumbnails_columns', 3 );
    
    		foreach ( $attachments as $key => $attachment ) {
    
    			if ( get_post_meta( $attachment->ID, '_woocommerce_exclude_image', true ) == 1 )
    				continue;
    
    			$classes = array( 'zoom' );
    
    			if ( $loop == 0 || $loop % $columns == 0 )
    				$classes[] = 'first';
    
    			if ( ( $loop + 1 ) % $columns == 0 )
    				$classes[] = 'last';
    
    			printf( '<a href="%s" title="%s" rel="thumbnails" class="%s">%s</a>', wp_get_attachment_url( $attachment->ID ), esc_attr( $attachment->post_title ), implode(' ', $classes), wp_get_attachment_image( $attachment->ID, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ) ) );
    
    			$loop++;
    
    		}
    	}
    ?></div>
  3. luisbonie
    Member
    Posted 1 year ago #

    Will close this... Sir Ben Blanco has made it happen for me... thanks anyway :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.