palsushobhan

wcfm-booking-calendar-event-visibility

Jul 22nd, 2025
559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.17 KB | None | 0 0
  1. add_action('after_wcfm_load_scripts', function($endpoint) {
  2.     if('wcfm-bookings-calendar' === $endpoint) {
  3.         if (defined('WC_BOOKINGS_VERSION') && version_compare(WC_BOOKINGS_VERSION, '1.15.0', '>=')) {
  4.             $admin_script_dependencies = wc_booking_get_script_dependencies( 'admin', [ 'jquery-ui-datepicker', 'jquery-ui-sortable' ] );
  5.             wp_enqueue_script( 'wc_bookings_admin_js', WC_BOOKINGS_PLUGIN_URL . '/dist/admin.js', $admin_script_dependencies, WC_BOOKINGS_VERSION, true );
  6.             if (WC_BOOKINGS_GUTENBERG_EXISTS) {
  7.                 $admin_calendar_gutenberg_deps = wc_booking_get_script_dependencies( 'admin-calendar-gutenberg', array( 'wc_bookings_admin_js' ) );
  8.                 wp_enqueue_script( 'wc_bookings_admin_calendar_gutenberg_js', WC_BOOKINGS_PLUGIN_URL . '/dist/admin-calendar-gutenberg.js', $admin_calendar_gutenberg_deps, WC_BOOKINGS_VERSION, true );
  9.             }
  10.            
  11.             wp_enqueue_script( 'wc_bookings_admin_calendar_js', WC_BOOKINGS_PLUGIN_URL . '/dist/admin-calendar.js', wc_booking_get_script_dependencies( 'admin-calendar' ), WC_BOOKINGS_VERSION, true );
  12.         }
  13.     }
  14. }, 29);
  15.  
  16. add_action( 'wp_footer', function() {
  17.     global $wp;
  18.     if( is_wcfm_page() && isset($wp->query_vars['wcfm-bookings-calendar']) && class_exists( 'WC_Site_Tracking' )) {
  19.         WC_Site_Tracking::add_tracking_function();
  20.     }
  21. } );
  22.  
  23. add_action('after_wcfm_load_styles', function($endpoint) {
  24.     if('wcfm-bookings-calendar' === $endpoint && WC_BOOKINGS_GUTENBERG_EXISTS) {
  25.         wp_enqueue_style('wc_bookings_admin_calendar_css', WC_BOOKINGS_PLUGIN_URL.'/dist/admin-calendar-gutenberg.css', null, WC_BOOKINGS_VERSION);
  26.         $calendar_event_popup_css = "
  27.            .wc-bookings-calendar-popover .components-popover__content {
  28.                background: #fff;
  29.                border-radius: 4px;
  30.                box-shadow: 0 0 0 1px #ccc,0 2px 3px #0000000d,0 4px 5px #0000000a,0 12px 12px #00000008,0 16px 16px #00000005;
  31.                box-sizing: border-box;
  32.                width: min-content;
  33.            }";
  34.         wp_add_inline_style( 'wc_bookings_admin_calendar_css', $calendar_event_popup_css );
  35.     }
  36. }, 29);
Advertisement
Add Comment
Please, Sign In to add comment