Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // WooCommerce - Do shortcode after given category
- add_action( 'woocommerce_after_main_content', 'my_action' );
- function my_action() {
- if (is_product_category()) {
- global $wp_query;
- $cat = $wp_query->get_queried_object();
- $cat_id = $cat->term_id;
- switch ($cat_id) {
- case 21: // my category id
- echo do_shortcode('[product id="1801"]');
- break;
- default:
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement