Home › Forums › Themes Support › Claue › to change Layout….
- This topic has 11 replies, 2 voices, and was last updated 5 years, 11 months ago by Harry.
-
AuthorPosts
-
-
January 17, 2019 at 6:43 am #28321
Is there any way to set up the layout like this ….
we found away to add the brand on this section, and I will be sending you the details to help you out, hopefully it will work and it wasn’t due to a plugin.
When a user is at adikkt.com/women it would display all categories so I would like to display the under title, then when a user clicks dresses … it will display the tags related to each dress.
Is there away to do this and have the same layout, please kindly let me know
Thanks
Kemal
Attachments:
You must be logged in to view attached files. -
January 17, 2019 at 4:47 pm #28327
Hi Kemal,
1. I’m sorry for portfolio page it doesn’t support show category below title
2. Please add below code to claue-child > functions.php
function category_single_product(){ $product_cats = wp_get_post_terms( get_the_ID(), 'product_cat' ); if ( $product_cats && ! is_wp_error ( $product_cats ) ){ $single_cat = array_shift( $product_cats ); ?> <p itemprop="name" class="product_category_title"><span><?php echo $single_cat->name; ?></span></p> <?php } } add_action( 'woocommerce_after_shop_loop_item_title', 'category_single_product', 25 );
Kind regards
Harry
Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio -
January 18, 2019 at 5:54 am #28348
as promised …
this is what they wrote …. I hope they did not add additional info while adding the code.
here it is …
Your theme don’t support standard hook action with woocommerce
https://docs.woocommerce.com/wc-apidocs/hook-docs.html
i have to Added some code in your theme in public_html/wp-content/themes/claue/core/libraries/vendors/woocommerce/templates/content-product.php line 136
HERE IS THE CODE:
global $post;
$id = $post->ID;
$brand = “”;if (get_option(‘pw_wooccommerce_display_brand_in_product_shop’) == “yes” || get_option(‘pw_woocommerce_image_brand_shop_page’) == “yes”) {
$terms = get_the_terms($post->ID, ‘product_brand’);
if (is_array($terms)) {
$brand .= ‘<span class=”pw_brand_product_list”>’;
if (get_option(‘pw_wooccommerce_display_brand_in_product_shop’) == “yes”) {$tax = get_option(‘pw_woocommerce_brands_text’, ”);
$brand .= ‘‘ . $tax . ‘‘;
if (is_array($terms)) {
$i = 0;
foreach ($terms as $b) {
$url = ”;
$url = esc_html(get_woocommerce_term_meta($b->term_id, ‘url’, true));
if ($url != ”) {
$brand .= ‘‘ . $b->name . ‘‘;
} else {
$brand .= ‘slug, ‘product_brand’) . ‘”>’ . $b->name . ‘‘;
}
if ($i < count($terms) – 1) {
$brand .= ‘, ‘;
}
$i++;
}
}
}
}if (get_option(‘pw_woocommerce_image_brand_shop_page’) == “yes”) {
$product_cats = wp_get_post_terms($post->ID, ‘product_brand’, array(“fields” => “ids”));$ratio = get_option(‘pw_woocommerce_image_brand_shop_page_image_size’, “150:150”);
list($width, $height) = explode(‘:’, $ratio);
foreach ($product_cats as $cat) {
$thumbnail = get_woocommerce_term_meta($cat, ‘thumbnail_id’, true);
if ($thumbnail) {
// $image = wp_get_attachment_thumb_url($thumbnail);
$image = current(wp_get_attachment_image_src($thumbnail, ‘full’));
$brand .= ‘‘;
}
}
}
$brand .= ‘</span>’;
}
echo $brand.'<br/>’;I hope it helps if you consider to add it to your theme.
Kemal
-
January 18, 2019 at 6:05 am #28349
Plus one more thing … can I have them clickable and it would take the user to the category they have clicked.
Plus, not sure if you understand this part also.
If a user selects “Dresses” … https://adikkt.com/fashion/women/womens-dresses/
then instead of saying Dresses, it will display there tags. Is this possible??
Thanks
-
January 18, 2019 at 10:56 am #28356
Hi,
1. Could you please paste your code at http://pastebin.com/ to keep correct format
2. Please change prev code to
add_action( 'woocommerce_after_shop_loop_item_title', 'VS_woo_loop_product_title', 25 ); function VS_woo_loop_product_title() { $terms = get_the_terms( $post->ID, 'product_cat' ); if ( $terms && ! is_wp_error( $terms ) ) : // only displayed if the product has at least one category $cat_links = array(); foreach ( $terms as $term ) { $cat_links[] = '<a href="'.esc_url( home_url() ).'/product-category/'.$term->slug.'">'.$term->name.'</a>'; } $on_cat = join( ", ", $cat_links ); ?> <p itemprop="name" class="product_category_title"><?php echo $on_cat; ?></p> <?php endif; }
Regards
Harry
Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio -
January 18, 2019 at 1:32 pm #28358
-
January 18, 2019 at 4:25 pm #28361
Hi,
Please add below code to claue-child > functions.php
add_action( 'woocommerce_shop_loop_item_title', 'woo_loop_brand', 25 ); function woo_loop_brand() { global $post; $id = $post->ID; $brand = ""; if (get_option('pw_wooccommerce_display_brand_in_product_shop') == "yes" || get_option('pw_woocommerce_image_brand_shop_page') == "yes") { $terms = get_the_terms($post->ID, 'product_brand'); if (is_array($terms)) { $brand .= '<span class="pw_brand_product_list">'; if (get_option('pw_wooccommerce_display_brand_in_product_shop') == "yes") { $tax = get_option('pw_woocommerce_brands_text', ''); $brand .= '<div class="wb-posted_in">' . $tax . '</div>'; if (is_array($terms)) { $i = 0; foreach ($terms as $b) { $url = ''; $url = esc_html(get_woocommerce_term_meta($b->term_id, 'url', true)); if ($url != '') { $brand .= '<a href="' . $url . '">' . $b->name . '</a>'; } else { $brand .= '<a href="' . get_term_link($b->slug, 'product_brand') . '">' . $b->name . '</a>'; } if ($i < count($terms) - 1) { $brand .= ', '; } $i++; } } } } if (get_option('pw_woocommerce_image_brand_shop_page') == "yes") { $product_cats = wp_get_post_terms($post->ID, 'product_brand', array("fields" => "ids")); $ratio = get_option('pw_woocommerce_image_brand_shop_page_image_size', "150:150"); list($width, $height) = explode(':', $ratio); foreach ($product_cats as $cat) { $thumbnail = get_woocommerce_term_meta($cat, 'thumbnail_id', true); if ($thumbnail) { // $image = wp_get_attachment_thumb_url($thumbnail); $image = current(wp_get_attachment_image_src($thumbnail, 'full')); $brand .= '<img src="' . $image . '" style="width:' . $width . 'px;height:' . $height . 'px" />'; } } } $brand .= '</span>'; } echo $brand.'<br/>'; }
Your code work with plugin to help you create brand not work without plugin.
We do not recommend override core theme, because when you update theme the file will revert.
Kind regards
Harry
Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio -
January 18, 2019 at 7:12 pm #28367
Should I revert back the edited theme core file?
-
January 18, 2019 at 7:23 pm #28368
Can we show the brand name only.
Currently its showing Brands: Dior. I want to show only Brand Name, Dior in this case.
-
January 18, 2019 at 11:37 pm #28378
Yes, please revert core file. And add below code.
.pw_brand_product_list .wb-posted_in {display: none;}
Kind regards
Harry
Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio -
January 20, 2019 at 5:32 am #28389
I don’t know if its possible or not.
I have three product category. Men, Women, Kids. I wanted to show tags in these category pages. And it’s working Fine.
Now I want to show Sub- Category instead of tags here,( only in women, men, and kids). But when a user clicks on a subcategory it needs to show tags.
Is that possible?
-
January 20, 2019 at 9:05 am #28390
Hi,
I’m sorry. I’m not sure about this, please contact with experts at https://bit.ly/2Loo6ke
Kind regards
Harry
Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio
-
-
AuthorPosts
You must be logged in to reply to this topic.