diff --git a/web/app/themes/mitlib-parent/functions.php b/web/app/themes/mitlib-parent/functions.php index c1c92b91..403788c7 100644 --- a/web/app/themes/mitlib-parent/functions.php +++ b/web/app/themes/mitlib-parent/functions.php @@ -181,7 +181,10 @@ function setup_scripts_styles() { // Hours bundle. wp_register_script( 'hours-scrollStick', get_template_directory_uri() . '/js/hours.scrollStick.js', array( 'jquery-cookie' ), $theme_version, true ); wp_register_script( 'hours-stickyMenu', get_template_directory_uri() . '/js/sticky-hours.menu.js', array( 'jquery-sticky' ), $theme_version, true ); - wp_register_script( 'parent-hours', get_template_directory_uri() . '/js/make.datepicker.js', array( 'jquery', 'gldatepickerJS', 'hours-scrollStick', 'hours-stickyMenu' ), $theme_version, true ); + wp_register_script( 'moment', get_template_directory_uri() . '/js/libs/moment.min.js', array(), $theme_version, true ); + wp_register_script( 'underscore', get_template_directory_uri() . '/js/libs/underscore.min.js', array(), $theme_version, true ); + wp_register_script( 'hours-loader', get_template_directory_uri() . '../../../plugins/mitlib-pull-hours/js/hours-loader.js', array(), $theme_version, true ); + wp_register_script( 'parent-hours', get_template_directory_uri() . '/js/make.datepicker.js', array( 'jquery', 'gldatepickerJS', 'hours-scrollStick', 'hours-stickyMenu', 'underscore', 'moment', 'hours-loader' ), $theme_version, true ); // Search bundle. wp_register_script( 'search-discovery', get_template_directory_uri() . '/js/ga_discovery.js', array(), $theme_version, false ); @@ -209,6 +212,7 @@ function setup_scripts_styles() { wp_enqueue_script( 'parent-guides-home' ); wp_enqueue_script( 'parent-hours-home' ); wp_enqueue_script( 'parent-search' ); + wp_enqueue_script( 'parent-hours' ); } /** @@ -237,6 +241,10 @@ function setup_scripts_styles() { wp_enqueue_script( 'parent-hours' ); } + if ( is_page_template( 'templates/page-location-2021.php' ) || is_page_template( 'templates/page-location.php' ) ) { + wp_enqueue_script( 'parent-hours' ); + } + if ( is_page( 'locations' ) ) { wp_enqueue_script( 'parent-map' ); } @@ -377,6 +385,26 @@ function mitlib_sidebars_init() { ) ); + register_sidebar( array( + 'name' => __( 'Location Hours Area', 'twentytwelve' ), + 'id' => 'sidebar-location-hours', + 'description' => __( 'Appears on library location pages, displaying a widget which displays the current hours for arbitrary locations. This enables a single location to display multiple sets of hours.', 'twentytwelve' ), + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', + ) ); + + register_sidebar( array( + 'name' => __( 'Below Hours Grid Area', 'twentytwelve' ), + 'id' => 'sidebar-below-hours-grid', + 'description' => __( 'Appears below the grid of library hours, allowing for widgets to describe locations that do not appear on the grid.', 'twentytwelve' ), + 'before_widget' => '', + 'before_title' => '

', + 'after_title' => '

', + ) ); + } add_action( 'widgets_init', 'Mitlib\Parent\mitlib_sidebars_init' );