| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?> |
| 2 |
<?php |
| 3 |
|
| 4 |
use MasterAddons\Inc\Classes\Helper; |
| 5 |
|
| 6 |
$args = array( |
| 7 |
'post_type' => 'product', |
| 8 |
'posts_per_page' => 1, |
| 9 |
'post_status' => 'publish', |
| 10 |
'page_id' => absint($prod_list) |
| 11 |
); |
| 12 |
|
| 13 |
$jltma_wc_wp_query = new WP_Query; |
| 14 |
|
| 15 |
$jltma_wc_wp_query->query($args); |
| 16 |
|
| 17 |
while ($jltma_wc_wp_query->have_posts()) { |
| 18 |
$jltma_wc_wp_query->the_post(); |
| 19 |
|
| 20 |
$jltma_wc_alt_text = get_post_meta(get_post_thumbnail_id(get_the_ID()), '_wp_attachment_image_alt', true); |
| 21 |
$excerpt = Helper::jltma_excerpt_truncate(get_the_excerpt(), esc_attr($excerpt_size), '...'); |
| 22 |
|
| 23 |
if (Helper::jltma_get_featured_image_url() !== false) { |
| 24 |
$featured_image_src = aq_resize(esc_url(Helper::jltma_get_featured_image_url()), $image_width, $image_height, true, true, true); |
| 25 |
} else { |
| 26 |
$featured_image_src = WP_PLUGIN_URL . '/woocommerce/assets/images/placeholder.png'; |
| 27 |
} |
| 28 |
?> |
| 29 |
|
| 30 |
<div class="jltma_wc_single_product_item"> |
| 31 |
<div class="jltma_wc_single_product_wrapper"> |
| 32 |
<?php |
| 33 |
if ($image_status == 'yes') { |
| 34 |
?> |
| 35 |
<div class="jltma_wc_prod_image_cont"> |
| 36 |
<img src="<?php echo esc_url($featured_image_src); ?>" alt="<?php echo esc_attr($jltma_wc_alt_text); ?>" /> |
| 37 |
</div> |
| 38 |
<?php |
| 39 |
} |
| 40 |
|
| 41 |
if ($title_status == 'yes') { |
| 42 |
?> |
| 43 |
<div class="jltma_wc_prod_title_cont"> |
| 44 |
<h3 class="jltma_wc_prod_title"> |
| 45 |
<a href="<?php echo (($title_link == 'yes') ? '' . esc_url(get_permalink()) . '' : 'javascript:void(0)'); ?>" class="<?php echo (($title_link == 'yes') ? '' : 'no_linked_title'); ?>"> |
| 46 |
<?php echo esc_html(get_the_title()); ?> |
| 47 |
</a> |
| 48 |
</h3> |
| 49 |
</div> |
| 50 |
<?php |
| 51 |
} |
| 52 |
|
| 53 |
if ($description_status == 'yes') { |
| 54 |
?> |
| 55 |
<div class="jltma_wc_prod_description_cont"> |
| 56 |
<?php echo esc_html($excerpt); ?> |
| 57 |
</div> |
| 58 |
<?php |
| 59 |
} |
| 60 |
?> |
| 61 |
|
| 62 |
<div class="jltma_wc_price_cont jltma_wc_cart_button_<?php echo esc_attr($cart_button); ?>"> |
| 63 |
<?php echo do_shortcode('[add_to_cart id="' . get_the_ID() . '" style="border: none;"]') ?> |
| 64 |
</div> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
<?php |
| 68 |
} |
| 69 |
|
| 70 |
wp_reset_postdata(); |
| 71 |
|