• Resolved dmahonwp

    (@dmahonwp)


    Hi guys, Great plugin. I wanted to display the calendar in two different pages only showing a chosen category on each page. Is there a shortcode that would help with that?

    • This topic was modified 4 years, 6 months ago by dmahonwp.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author moiseh

    (@moiseh)

    Hello,

    This feature it’s only available in premium version unfortunately.
    But, you can add this code in theme functions.php to filter by category slug:

    add_filter('wbc_booking_products_args', 'my_booking_product_args', 10, 1);
    function my_booking_product_args($args) {
        $categorySlugs = !empty($_POST['category_slugs']) ? explode(',', $_POST['category_slugs']) : wbc_option('filter_categories');
    
        if ( !empty($categorySlugs) ) {
            $args['tax_query'][] = array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug',
                'terms'    => $categorySlugs,
                'operator' => 'IN',
            );
        }
    
        return $args;
    }

    Then this shortcodes for example:
    Page 1:
    [wbc-calendar cat="slug1"]

    Page 2:
    [wbc-calendar cat="slug2"]

    Thread Starter dmahonwp

    (@dmahonwp)

    Thanks so much. The only thing is when I try this it gives me a syntax error. I cant see anything missing in the code tho.

    Plugin Author moiseh

    (@moiseh)

    Hi,
    I’ve added this excatly posted code at end of my theme functions.php and didn’t receive syntax error. Can you please provide PHP version and paste the error?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘different Category Displays’ is closed to new replies.