function fflcommerce_get_image_placeholder($size = 'shop_small') { $image_size = fflcommerce_get_image_size($size); return apply_filters('fflcommerce_image_placeholder_html', '<img src="' . FFLCOMMERCE_URL . '/assets/images/placeholder.png" alt="Placeholder" width="' . $image_size[0] . '" height="' . $image_size[1] . '" />', $image_size); }
/** * Get the main product image or parents image * * @param string $size * @return string HTML */ public function get_image($size = 'shop_thumbnail') { // Get the image size $size = fflcommerce_get_image_size($size); // If product has an image if (has_post_thumbnail($this->ID)) { return get_the_post_thumbnail($this->ID, $size); } // If product has a parent and that has an image display that if (($parent_ID = wp_get_post_parent_id($this->ID)) && has_post_thumbnail($parent_ID)) { return get_the_post_thumbnail($this->ID, $size); } // Otherwise just return a placeholder return fflcommerce_get_image_placeholder($size); }