Home › Forums › WoodMart support forum › Html Blocks on Brand page
Html Blocks on Brand page
- This topic has 13 replies, 4 voices, and was last updated 6 years, 2 months ago by Artem Temos.
-
AuthorPosts
-
April 20, 2018 at 10:47 am #53569
Stanley BlackParticipantHello,
Html blocks work fine on products category pages, menu…
But not working on brand page.
In the brand terms description by default is set [html_block id="88"] but with no effect on the front. It’s not working.Kind regards
April 20, 2018 at 2:05 pm #53607
Elise NoromitMemberHello,
Please provide the link to the page where you have added this HTML? Also please provide your site access we shall check settings.
Best regards
April 20, 2018 at 2:14 pm #53609
Stanley BlackParticipantHi,
April 20, 2018 at 2:15 pm #53610
Artem TemosKeymasterActually, it is not a brand page. It is a shop page but with products filtered by brand. WooCommerce doesn’t show an attribute description there. Sorry, but we can’t change this in our theme scope.
April 20, 2018 at 2:26 pm #53620
Stanley BlackParticipantHello,
thanks for response. How to create brand page where I can include html block.
April 20, 2018 at 3:59 pm #53640
Elise NoromitMemberHello,
I have checked your settings. Your brands are displayed properly but not configured.
1/ Enter Brand Attribute: Products > Attributes > Configure Brands http://prntscr.com/j7w79q create a separate HTML block for each brand and fill it with information. Now you have ID 88 block and it contains the slider “proba” (check Slider Revolution – Sliders)
2/ Products > Attributes > Configure Brands > insert [html_block id="88"] into the brend description (you will have different IDs)
3/ Enter each product make sure you have added Brand attribute and chosen the proper one for the product.
Best Regards
April 20, 2018 at 4:37 pm #53642
Stanley BlackParticipantHello,
Thanks for your response, it’s works now.
It’s all clear to me now. Problem is that theme element Brands display brands like shop filters(shop/?filter_brand=alessi) and this is url(brand/alessi/) which I needed.
One more question?
On product page next to product title is brand image(screenshot.png).
This brand image have shop/?filter_brand=alessi url and I want to replace this url with brand/alessi/ url.
It’s imortant to me because I want when somebody click on brand image goes to brand/alessi/ page wich have html block included not on shop/?filter_brand=alessi page wich can’t have html blocks included.
Kind regards
Attachments:
You must be logged in to view attached files.April 20, 2018 at 6:39 pm #53656
Artem TemosKeymasterTry to add the following PHP code snippet to the child theme functions.php file to do this
function woodmart_product_brand() { global $product; $attr = woodmart_get_opt( 'brands_attribute' ); if( ! $attr || ! woodmart_get_opt( 'product_page_brand' ) ) return; $attributes = $product->get_attributes(); if( ! isset( $attributes[ $attr ] ) || empty( $attributes[ $attr ] ) ) return; $brands = wc_get_product_terms( $product->get_id(), $attr, array( 'fields' => 'all' ) ); if( empty( $brands ) ) return; if ( defined( 'SHOP_IS_ON_FRONT' ) ) { $link = home_url(); } else { $link = get_post_type_archive_link( 'product' ); } echo '<div class="woodmart-product-brands">'; foreach ($brands as $brand) { $image = get_term_meta( $brand->term_id, 'image', true); $filter_name = 'filter_' . sanitize_title( str_replace( 'pa_', '', $attr ) ); $attr_link = get_term_link( $brand->term_id, $brand->taxonomy ); if( ! empty( $image ) ) { echo '<div class="woodmart-product-brand">'; echo '<a href="' . esc_url( $attr_link ) . '"><img src="' . esc_url( $image ) . '" title="' . esc_attr( $brand->slug ) . '" alt="' . esc_attr( $brand->slug ) . '" /></a>'; echo '</div>'; } } echo '</div>'; }
April 20, 2018 at 6:46 pm #53657
Stanley BlackParticipantPerfect!!!!!
April 21, 2018 at 7:01 am #53677
Artem TemosKeymasterGreat 🙂
October 4, 2018 at 9:59 pm #81002
plusinternetParticipantDoes this just change the link? I have added the code and my brand logos now link through to /brands/brandname/ which is great but how do I add a HTML block to /brands/brandname/ ?
October 4, 2018 at 10:12 pm #81003
plusinternetParticipantIgnore above, cleared cache -_-
October 4, 2018 at 10:20 pm #81004
plusinternetParticipantWould you be able to implement this for all brand links? I have the brand logos displayed on my homepage inside a Woodmart Brand Element and also the category is displayed above the product title on the category pages etc.
October 5, 2018 at 6:10 am #81037
Artem TemosKeymasterTry to add the following PHP code snippet to the child theme functions.php file to do this
add_filter( 'woodmart_brands_link', function( $link, $brand ){ return get_term_link( $brand->term_id, $brand->taxonomy ); }, 10, 2 );
-
AuthorPosts
- You must be logged in to create new topics. Login / Register