Quote from woody@onlinegraphicscanada.com on September 16, 2022, 02:16
https://marketplace.clinchflyfishing.com/shop/?swoof=1&product_cat=hats
Everything is working great right now and I did have the category titles showing previously but it just stopped working for some reason.
Here is the functions.php script we are using now:
add_action('woocommerce_before_shop_loop', 'show_category_title', 10, 2);
function show_category_title() {
$cat_title = single_tag_title("", false);
echo '<h1 class="category-title">' . $cat_title . '</h1>';
}
We did get our vendor locations to show up after filtering them like so:
add_action( 'woocommerce_after_shop_loop_item_title', 'custom_field_display_below_title', 30 );
function custom_field_display_below_title(){
global $product;
$values = (array) get_field( 'product_location', $product->get_id() ); // Get custom field values
// Display custom field values
if( ! empty($values) ) {
echo '<p class="vendor-location"><a class="vendor-name-link" href="' . get_bloginfo('url') . '/shop/?swoof=1&pa_location=' . str_replace(" ", "-", strtolower(implode( ', ', $values ))) . '" class="product_location">' . implode( ', ', $values ) . '</a></p>';
}
}
Any ideas?
Woody House
https://marketplace.clinchflyfishing.com/shop/?swoof=1&product_cat=hats
Everything is working great right now and I did have the category titles showing previously but it just stopped working for some reason.
Here is the functions.php script we are using now:
add_action('woocommerce_before_shop_loop', 'show_category_title', 10, 2);
function show_category_title() {
$cat_title = single_tag_title("", false);
echo '<h1 class="category-title">' . $cat_title . '</h1>';
}
We did get our vendor locations to show up after filtering them like so:
add_action( 'woocommerce_after_shop_loop_item_title', 'custom_field_display_below_title', 30 );
function custom_field_display_below_title(){
global $product;
$values = (array) get_field( 'product_location', $product->get_id() ); // Get custom field values
// Display custom field values
if( ! empty($values) ) {
echo '<p class="vendor-location"><a class="vendor-name-link" href="' . get_bloginfo('url') . '/shop/?swoof=1&pa_location=' . str_replace("","-", strtolower(implode( ', ', $values ))) . '" class="product_location">' . implode( ', ', $values ) . '</a></p>';
}
}
Any ideas?
Woody House