/** * Adds sidebars to a publicly available variable for later consumption * and generates the sidebars * * @param array $sidebars * @return void */ public static function init($sidebars) { self::$sidebars = $sidebars; // Generate sidebars self::generate_sidebars($sidebars); }
if (is_page_template("templates/template-gaming.php")) { wp_enqueue_script('gaming', get_stylesheet_directory_uri() . '/js/gaming-script.js', array('jquery'), 1, true); } } } wp_enqueue_script('vimeo', get_stylesheet_directory_uri() . '/js/jquery.vimeo.api.js', array('jquery'), 1, true); if (is_page_template("templates/caas-template.php")) { wp_enqueue_script('caas_script', get_stylesheet_directory_uri() . '/js/caas.js', array('jquery'), 1, true); } } add_action('wp_enqueue_scripts', 'theme_scripts'); /** * Generate sidebars and assign them to different templates */ $sidebars = array('corporate_policies' => array(), 'home' => array('home_content' => array('name' => 'Home Content', 'dir' => 'home/primary'), 'home_widget_1' => array('name' => 'Home Widget 1', 'dir' => 'home'), 'home_widget_2' => array('name' => 'Home Widget 2', 'dir' => 'home'), 'home_widget_3' => array('name' => 'Home Widget 3', 'dir' => 'home')), 'template-a' => array('template_a_flex' => array('name' => 'Flex', 'dir' => 'template_a/flex'), 'template_a_content' => array('name' => 'Content', 'dir' => 'content'), 'template_a_widget_1' => array('name' => 'Widget 1', 'dir' => 'template_a'), 'template_a_widget_2' => array('name' => 'Widget 2', 'dir' => 'template_a'), 'template_a_widget_3' => array('name' => 'Widget 3', 'dir' => 'template_a')), 'template-b' => array('template_b_content' => array('name' => 'Content', 'dir' => 'content'), 'template_b_right_sidebar' => array('name' => 'Right Sidebar', 'dir' => 'right_sidebar')), 'template-test' => array('template_test_content' => array('name' => 'Content', 'dir' => 'content'), 'template_test_right_sidebar' => array('name' => 'Right Sidebar', 'dir' => 'right_sidebar')), 'template-c' => array('template_c_content' => array('name' => 'Content', 'dir' => 'content'), 'template_c_left_sidebar' => array('name' => 'Left Sidebar', 'dir' => 'left_sidebar')), 'template-d' => array('template_d_content' => array('name' => 'Content', 'dir' => 'content')), 'template-e' => array('template_e_hero' => array('name' => 'Hero', 'dir' => 'hero'), 'template_e_left_sidebar' => array('name' => 'Left Sidebar', 'dir' => 'left_sidebar'), 'template_e_right_sidebar' => array('name' => 'Right Sidebar', 'dir' => 'right_sidebar')), 'template-f' => array('template_f_flex' => array('name' => 'Flex', 'dir' => 'template_f/flex'), 'template_f_widget_1' => array('name' => 'Widget 1', 'dir' => 'template_f'), 'template_f_widget_2' => array('name' => 'Widget 2', 'dir' => 'template_f/right_column')), 'template-g' => array(), 'template-h' => array('template_h_flex' => array('name' => 'Flex', 'dir' => 'template_h')), 'template-i' => array('template_i_widget_1' => array('name' => 'Widget 1', 'dir' => 'widget'), 'template_i_widget_2' => array('name' => 'Widget 2', 'dir' => 'widget'), 'template_i_widget_3' => array('name' => 'Widget 3', 'dir' => 'widget')), 'template-j' => array('template_j_content' => array('name' => 'Content', 'dir' => 'content'), 'template_j_right_sidebar' => array('name' => 'Right Sidebar', 'dir' => 'right_sidebar')), 'template-k' => array('template_k_content' => array('name' => 'Content', 'dir' => 'content'), 'template_k_right_sidebar' => array('name' => 'Right Sidebar', 'dir' => 'right_sidebar')), 'navigation' => array('super_nav_con_1_col_1' => array('name' => 'Container 1 - Column 1', 'dir' => 'super_nav'), 'super_nav_con_1_col_2' => array('name' => 'Container 1 - Column 2', 'dir' => 'super_nav'), 'super_nav_con_1_col_3' => array('name' => 'Container 1 - Column 3', 'dir' => 'super_nav'), 'super_nav_footer_con_1_col_2' => array('name' => 'Container 1 - Footer - Column 2', 'dir' => 'super_nav/footer'), 'super_nav_footer_con_1_col_3' => array('name' => 'Container 1 - Footer - Column 3', 'dir' => 'super_nav/footer'), 'super_nav_con_2_col_1' => array('name' => 'Container 2 - Column 1', 'dir' => 'super_nav/industries'), 'super_nav_con_2_col_2' => array('name' => 'Container 2 - Column 2', 'dir' => 'super_nav/industries'), 'super_nav_con_2_col_3' => array('name' => 'Container 2 - Column 3', 'dir' => 'super_nav/industries'), 'super_nav_footer_con_2_col_2' => array('name' => 'Container 2 - Footer - Column 2', 'dir' => 'super_nav/footer'), 'super_nav_footer_con_2_col_3' => array('name' => 'Container 2 - Footer - Column 3', 'dir' => 'super_nav/footer'), 'super_nav_con_3_col_1' => array('name' => 'Container 3 - Column 1', 'dir' => 'super_nav'), 'super_nav_con_3_col_2' => array('name' => 'Container 3 - Column 2', 'dir' => 'super_nav'), 'super_nav_con_3_col_3' => array('name' => 'Container 3 - Column 3', 'dir' => 'super_nav'), 'super_nav_footer_con_3_col_2' => array('name' => 'Container 3 - Footer - Column 2', 'dir' => 'super_nav/footer'), 'super_nav_footer_con_3_col_3' => array('name' => 'Container 3 - Footer - Column 3', 'dir' => 'super_nav/footer')), 'blog' => array('blog_right_sidebar' => array('name' => 'Right Sidebar', 'dir' => 'right_sidebar'))); Sidebars::init($sidebars); /** * Get Top Parent Page IDa * * @param $post * @return mixed */ function get_top_parent_page_id($post) { if ($post->post_parent) { $ancestors = get_post_ancestors($post->ID); $root = count($ancestors) - 1; $parent = $ancestors[$root]; } else { $parent = $post->ID; }