To display a Product Category Slider in the Category Archive Page first, you have to create a Category Slider Shortcode from the WooCommerce Category Slider Pro plugin. An expanded description is available in the link about creating the category slider.
After creating a category slider shortcode, you can easily display the slider on the category archive page by using the following codes in your current theme’s functions.php file.
1) How to display the category slider on the archive page before the breadcrumb
2) How to display the category slider on the archive page after the breadcrumb
3) How to display the category slider on the archive page before the description
4) How to display the category slider on the archive page after the description
5) How to display the category slider on the archive page after the shop loop
1) How to add the category slider on the archive page before the breadcrumb
If you want to display the category slider on the category archive page before the breadcrumb, you can add the following custom code in your current theme’s functions.php file. If you check the code, you will see there is an action hook available in the plugin by which you can create a function, use your shortcode of the category slider, and echo it to display on the archive page. After that, you may need some custom CSS to fix the slider style.
// Category Slier before Breadcrumb add_action('woocommerce_before_main_content', 'woo_cat_slider_show_in_archive', 15); function woo_cat_slider_show_in_archive() { echo do_shortcode('[woocatslider id="116"]'); }
2) How to add the category slider on the archive page after the breadcrumb
Suppose, you want to display the category slider on the category archive page after the breadcrumb and before the title. Well, you can add the following custom code in your current theme’s functions.php file. If you check the code, you will see there is an action hook available by which you can create a function, use your shortcode, and echo it to display on the archive page. After that, you may need some custom CSS to fix the slider style.
// Category Slider after Breadcrumb and before Title add_action('woocommerce_before_main_content', 'woo_cat_slider_show_in_archive', 25); function woo_cat_slider_show_in_archive() { echo do_shortcode('[woocatslider id="116"]'); }
3) How to add the category slider on the archive page before the description
If you want to display the category slider on the category archive page before the category description, you can add the following custom code in your current theme’s functions.php file. If you check the code, you will see there is an action hook available in the plugin by which you can create a function, use your shortcode of the category slider, and echo it to display on the archive page. After that, you may need some custom CSS to fix the slider style.
// Category Slider before Description add_action('woocommerce_archive_description', 'woo_cat_slider_show_in_archive', 5); function woo_cat_slider_show_in_archive() { echo do_shortcode('[woocatslider id="116"]'); }
4) How to add the category slider on the archive page after the description
Suppose, you want to display the category slider on the category archive page after the category description, you can add the following custom code in your current theme’s functions.php file. If you check the code, you will see there is an action hook available in the plugin by which you can create a function, use your shortcode of the category slider, and echo it to display on the archive page. After that, you may need some custom CSS to fix the slider style.
// Category Slider after Description add_action('woocommerce_archive_description', 'woo_cat_slider_show_in_archive'); function woo_cat_slider_show_in_archive() { echo do_shortcode('[woocatslider id="116"]'); }
5) How to display the category slider on the archive page after the shop loop
Suppose, you want to display the category slider on the category archive page after the shop loop, you can add the following custom code in your current theme’s functions.php file. If you check the code, you will see there is an action hook available in the plugin by which you can create a function, use your shortcode of the category slider, and echo it to display on the archive page. After that, you may need some custom CSS to fix the slider style.
// Category Slider after Shop Loop add_action('woocommerce_after_shop_loop', 'woo_cat_slider_show_in_archive'); function woo_cat_slider_show_in_archive() { echo do_shortcode('[woocatslider id="116"]'); }