This topic has 8 replies, 3 voices, and was last updated 10 months, 1 weeks ago ago by Andrew Mitchell
Hi, I am looking for the WooCommerce hook to display a title before the category list and the product list in the shop page.
actually, into the xstore options, I chosed to display category and products but the UX is not clear.
so I want to add a title to do like :
title : CATEGORY
list of categories
margin –
title : products
list of products.
thank you
Dear @Gbp,
We hope this message finds you well.
To ensure that both categories and products are displayed on your shop page, kindly follow the steps outlined below:
1. Access the ‘Theme Options’ panel.
2. Navigate to ‘WooCommerce (shop)’ and then to ‘Product Catalog’.
3. Within the ‘Product Catalog’ settings, please select ‘Show categories & products’.
4. Proceed to ‘Categories Appearance’ and choose ‘Apart from products’.
For your reference, here are screenshots illustrating the aforementioned settings:
– [Screenshot 1](https://prnt.sc/MM0uObOQOugi)
– [Screenshot 2](https://prnt.sc/McVhiLcOsfsK)
Additionally, to display headlines for Category and Product sections before the respective items, please insert the following code snippet into your theme’s functions.php file or a custom plugin:
add_action('etheme_before_product_loop_start', 'n2t_woocommerce_before_shop_loop', 999);
function n2t_woocommerce_before_shop_loop(){
echo '<h2 class="custom-category-headline">Categories</h2>';
}
add_filter('woocommerce_after_output_product_categories', 'n2t_woocommerce_after_output_product_categories', 999);
function n2t_woocommerce_after_output_product_categories($value){
if ( wc_get_loop_prop( 'is_shortcode' ) && ! WC_Template_Loader::in_content_filter() ) {
return $value;
}
if ( get_option( 'woocommerce_shop_page_categories_appearance', '' ) ) {
if ( woocommerce_get_loop_display_mode() == 'both' ) {
return '<div class="etheme-woocommerce-categories-products-separator"></div><h2 class="custom-category-headline">Products</h2>';
}
}
return $value;
}
We trust that the above instructions will be of assistance to you. Should you require any further support, please do not hesitate to reach out.
Best regards,
The 8Theme Team
Hi thank you !
It is working but not completely correctly.
the H2 with products is not displayed correctly,
it is not making the correct separation.
Thank you for checking and helping
best
Hi @Gbp,
We’ve changed your custom CSS codes to this:
.custom-category-headline {
margin: 40px 0;
text-align: center;
width: 100%;
}
Now everything looks good.
Best regards,
The 8Theme Team
Awesome ! thank you !
going to add the border to the 1st raw of the product, because it is not displayed.
best.
Hi @Gbp,
We’ve updated the custom CSS codes per your request:
Best regards,
The 8Theme Team
Awesome,
thanks
Dear Gbp,
Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?
Click here to share your insights: https://themeforest.net/downloads
Your support fuels our journey, and we appreciate it more than words can express.
Best Regards,
The 8Theme Team
The issue related to '‘Add Titles to shop page before category and product sections’' has been successfully resolved, and the topic is now closed for further responses