This is a plugin theme issue.
My plugin works with this template page that I have made.(modified)
The orginal file product-image.php.
My modified file product-image-360.php
I have added 3 custom field to the product post.
magnified_image_filename– gives the plugin the name of the file that is needed for it to run;magnified_image– gives the path to the image;360– class field is used to identify the post to see whether or not to enable pretty photo in the post.
This bit of code is really clever for allowing you to turn off a feature for a globally assigned class i.e prettyPhoto. This allows me to Enable the prettyPhoto from the featured images and turn it off when I include a class field of 360 yes for post and product images.
global $post,$woocommerce;
$threesixty = get_post_meta($post->ID, '360', true);
if ($threesixty == '') {
wp_register_script( 'prettyPhoto', get_template_directory_uri() . '/includes/js/jquery.prettyPhoto.js', array( 'jquery' ) );
}
However I now have two product-image.php templates. How do I combine them into a conditional statement that changes the rel and class attributes depending upon a custom field of 360?
Well, if they don’t have a ‘360’ field, then we’ll assume that get_post_meta($post->ID, ‘360’, true); will return false.