Support › Forums › Support (Legacy) › Woo product gallery click (or hover) to substitute the main product image › Reply To: Woo product gallery click (or hover) to substitute the main product image
1. עינין התמונות:
עשיתי קסטומיזציה של מוצר בודד עם הקוד הבא:
remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_upsell_display’, 15 );
function my_wc_product_content() {
// content here.
$args = array(
‘post_type’ => ‘attachment’,
‘post_status’ => ‘any’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘category’,
‘field’ => ‘name’,
‘terms’ =>get_the_title()
)
)
);
$the_query = new WP_Query( $args );
// div to wrap all the media uploads
echo “<div class = ‘media_uploads_box’>”;
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
//echo wp_get_attachment_image( get_the_ID(), ‘full’ );
// thumbnail instead of full image
echo “<div class = ‘media_single_upload_box’>”;
echo “” . wp_get_attachment_image( get_the_ID(), ‘thumbnail’ ) . “</img>”;
// show the name of image(title)
echo “<p class = ‘media_upload_title’>” . get_the_title() . “</p>”;
echo “</div>”;
//echo get_the_content();
//echo get_the_post_thumbnail( $post_id, ‘thumbnail’ );
//echo the_attachment_link( $image->ID, true );
}
} else {
// no attachments found
}
echo “</div”; // “<div class = ‘media_uploads’>”;
wp_reset_postdata();
} //function my_wc_product_content() {
add_action( ‘woocommerce_after_single_product_summary’, ‘my_wc_product_content’, 15 );
הקוד הראשון מוריד את האפסלס
הקוד השני מישם לופ עם הטמבניילס הרצויים
2. לינק להדגמה עם אבדה
http://www.triplebit.com/avada2/product/%D7%A2%D7%92%D7%99%D7%9C%D7%99-%D7%9C%D7%91-%D7%A6%D7%9E%D7%95%D7%93%D7%99%D7%9D-%D7%9E%D7%96%D7%94%D7%91/
תקיש על הטמבניילס מתחת לתמונה הראשית ותראה
שוב תודה
