<div class="row service-products">
<div class="col-md-5 d-none d-md-block">
<?php if ( have_rows( 'service_products' ) ) : ?>
<div class="service-product-tabs">
<?php while ( have_rows( 'service_products' ) ) : the_row();
$product_tab = get_sub_field( 'product_tab' );
$product_tab_icon = get_sub_field( 'product_tab_icon' );
?>
<button type="button" class="product-tab">
<?php if ( $product_tab_icon ) : ?>
<span class="img-wrapper"><img class="img-svg" src="<?php echo esc_html( $product_tab_icon ); ?>" alt="<?php echo esc_html( $product_tab ); ?>"></span>
<?php endif; ?>
<?php if ( $product_tab ) : ?>
<span class="text-wrapper"><?php echo esc_html( $product_tab ); ?></span>
<?php endif; ?>
</button>
<?php endwhile; ?>
</div>
<?php endif; ?>
</div>
<div class="col-md-7">
<?php if ( have_rows( 'service_products' ) ) : ?>
<div class="service-product-content resp-tabs-container">
<?php while ( have_rows( 'service_products' ) ) : the_row();
$product_title = get_sub_field( 'product_title' );
$product_image = get_sub_field( 'product_image' );
$product_content = get_sub_field( 'product_content' );
?>
<div class="product-tab-item">
<?php if ( $product_image ) : ?>
<div class="img-wrapper">
<img src="<?php echo esc_url( $product_image['url'] ); ?>" alt="<?php echo esc_attr( $product_image['alt'] ); ?>" />
</div>
<?php endif; ?>
<?php if ( $product_title ) : ?>
<h3 class="product-tab-title"><?php echo esc_html( $product_title ); ?></h3>
<?php endif; ?>
<?php if ( $product_content ) : ?>
<div class="product-tab-content"><?php echo wp_kses_post( $product_content ); ?></div>
<?php endif; ?>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
</div>
</div>
add_action( 'woocommerce_before_shop_loop_item_title', 'custom_show_product_cat', 30 );
function custom_show_product_cat() {
global $product;
echo wc_get_product_category_list( $product->get_id(), ', ', '<div class="product-cat">' . _n( 'Category:', 'Categories:', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</div>' );
}
<?php
$image = get_field('image');
$size = 'full'; // (thumbnail, medium, large, full or custom size)
if( $image ) {
echo wp_get_attachment_image( $image, $size );
}
<?php the_field('header_phone_text', options); ?>
// Move WooCommerce subcategory list items into heir own <ul> separate from the product <ul>
add_action( 'init', 'move_subcat_lis' );
function move_subcat_lis() {
// Remove the subcat <li>s from the old location.
remove_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' );
add_action( 'woocommerce_before_shop_loop', 'msc_product_loop_start', 40 );
add_action( 'woocommerce_before_shop_loop', 'msc_maybe_show_product_subcategories', 50 );
add_action( 'woocommerce_before_shop_loop', 'msc_product_loop_end', 60 );
}
//Conditonally start the product loop with a <ul> contaner if subcats exist.
function msc_product_loop_start() {
$subcategories = woocommerce_maybe_show_product_subcategories();
if ( $subcategories ) {
echo '<ul class="archive-category-wrapper">';
}
}
//Print the subcat <li>s in our new location.
function msc_maybe_show_product_subcategories() {
echo woocommerce_maybe_show_product_subcategories();
}
//Conditonally end the product loop with a </ul> if subcats exist.
function msc_product_loop_end() {
$subcategories = woocommerce_maybe_show_product_subcategories();
if ( $subcategories ) {
echo '</ul>';
}
}
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'custom_product_thumbnail', 10 );
function custom_product_thumbnail() {
global $product;
$id = $product->get_id();
$custom_image = get_field( 'product_custom_img', $id );
echo '<div class="custom-woo-img"><img src="' . $custom_image . '"></div>';
}
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = 'http://code.jquery.com/jquery-latest.js';
newScript.onload = function() {
alert("Script is ready!");
$(document).ready(function() {
alert("JQuery is ready!");
});
};
var head = document.getElementsByTagName("head")[0];
head.appendChild(newScript);