add_action( 'homepage', 'mason', 44 );
function mason( ) { ?>
<?php
$args = array(
'taxonomy' => 'product_cat',
'orderby' => 'tax_position',
'meta_key' => 'tax_position',
'order' => 'ASC',
'hide_empty' => true
);
$product_categories = get_terms( $args );
$count = count($product_categories);
if ( $count > 0 ){
foreach ( $product_categories as $product_category ) {
$thumbnail_id = get_woocommerce_term_meta( $product_category->term_id, 'thumbnail_id', true );
$item = '<div class="catalogue-item">';
$item .= '<a href="';
$item .= '" class="catalogue-item-link">';
$item .= '<div class="catalogue-item-img tilt">';
$item .= '<img src="'. wp_get_attachment_url( $thumbnail_id ) .'" alt="" >';
$item .= '</div>';
$item .= '<p class="catalog-item-title">' . $product_category->name . '</p>';
$item .= '</div></a>';
echo $item;
}
}
?>
<?php
}
<?php
$args = array(
'taxonomy' => 'product_cat',
'orderby' => 'tax_position',
'meta_key' => 'tax_position',
'order' => 'ASC',
'hide_empty' => true
);
$product_categories = get_terms( $args );
$count = count($product_categories);
if ( $count > 0 ){
foreach ( $product_categories as $product_category ) {
$link = get_field( 'url_cat', $product_category );
$thumbnail_id = get_woocommerce_term_meta( $product_category->term_id, 'thumbnail_id', true );
$item = '<div class="catalogue-item">';
$item .= '<a href="'.$link.'"class="catalogue-item-link"'>;
$item .= '<div class="catalogue-item-img tilt">';
$item .= '<img src="'. wp_get_attachment_url( $thumbnail_id ) .'" alt="" >';
$item .= '</div>';
$item .= '<p class="catalog-item-title">' . $product_category->name . '</p>';
$item .= '</div></a>';
echo $item;
}
}
?>