'; $output .= '

' . esc_html( get_bloginfo( 'name' ) ) . '

'; $output .= '

' . esc_html( get_bloginfo( 'description' ) ) . '

'; $output .= ''; } // Output logo is set if ( ! empty( $output ) ) { return $output; } } /* ---------------------------------------------------------------------------------- Page Layout ---------------------------------------------------------------------------------- */ /* Add Custom Sidebar css */ function astronomy_sidebar_css() { // Get theme options values. $astronomy_homepage_layout = astronomy_var ( 'astronomy_homepage_layout' ); $astronomy_general_layout = astronomy_var ( 'astronomy_general_layout' ); $astronomy_blog_layout = astronomy_var ( 'astronomy_blog_layout' ); $astronomy_post_layout = astronomy_var ( 'astronomy_post_layout' ); $astronomy_portfolio_layout = astronomy_var ( 'astronomy_portfolio_layout' ); $astronomy_project_layout = astronomy_var ( 'astronomy_project_layout' ); $astronomy_woocommerce_layout = astronomy_var ( 'astronomy_woocommerce_layout' ); $astronomy_woocommerce_layoutproduct = astronomy_var ( 'astronomy_woocommerce_layoutproduct' ); if ( is_front_page() ) { if ( $astronomy_homepage_layout == "option1" or empty( $astronomy_homepage_layout ) ) { echo ''; } else if ( $astronomy_homepage_layout == "option2" ) { wp_enqueue_style ( 'astronomy-sidebarleft' ); } else if ( $astronomy_homepage_layout == "option3" ) { wp_enqueue_style ( 'astronomy-sidebarright' ); } } else if ( is_page() ) { if ( $astronomy_general_layout == "option1" or empty( $astronomy_general_layout ) ) { echo ''; } else if ( $astronomy_general_layout == "option2" ) { wp_enqueue_style ( 'astronomy-sidebarleft' ); } else if ( $astronomy_general_layout == "option3" ) { wp_enqueue_style ( 'astronomy-sidebarright' ); } } else if ( astronomy_check_isblog() and ! is_single() and ! is_post_type_archive( 'portfolio' ) and ! is_post_type_archive( 'product' ) ) { if ( $astronomy_blog_layout == "option1" or empty( $astronomy_blog_layout ) ) { echo ''; } else if ( $astronomy_blog_layout == "option2" ) { wp_enqueue_style ( 'astronomy-sidebarleft' ); } else if ( $astronomy_blog_layout == "option3" ) { wp_enqueue_style ( 'astronomy-sidebarright' ); } } else if ( is_post_type_archive( 'product' ) or is_tax( 'product_cat' ) or is_tax( 'product_tag' ) ) { if ( $astronomy_woocommerce_layout == "option1" or empty( $astronomy_woocommerce_layout ) ) { echo ''; } else if ( $astronomy_woocommerce_layout == "option5" or $astronomy_woocommerce_layout == "option7" ) { wp_enqueue_style ( 'astronomy-sidebarleft' ); } else if ( $astronomy_woocommerce_layout == "option6" or $astronomy_woocommerce_layout == "option8" ) { wp_enqueue_style ( 'astronomy-sidebarright' ); } else { echo ''; } } else if ( is_singular( 'post' ) ) { if ( $astronomy_post_layout == "option1" or empty( $astronomy_post_layout ) ) { echo ''; } else if ( $astronomy_post_layout == "option2" ) { wp_enqueue_style ( 'astronomy-sidebarleft' ); } else if ( $astronomy_post_layout == "option3" ) { wp_enqueue_style ( 'astronomy-sidebarright' ); } else { echo ''; } } else if ( is_singular( 'portfolio' ) ) { if ( $astronomy_project_layout == "option1" or empty( $astronomy_project_layout ) ) { echo ''; } else if ( $astronomy_project_layout == "option2" ) { wp_enqueue_style ( 'astronomy-sidebarleft' ); } else if ( $astronomy_project_layout == "option3" ) { wp_enqueue_style ( 'astronomy-sidebarright' ); } else { echo ''; } } else if ( is_singular( 'product' ) ) { if ( $astronomy_woocommerce_layoutproduct == "option1" or empty( $astronomy_woocommerce_layoutproduct ) ) { echo ''; } else if ( $astronomy_woocommerce_layoutproduct == "option2" ) { wp_enqueue_style ( 'astronomy-sidebarleft' ); } else if ( $astronomy_woocommerce_layoutproduct == "option3" ) { wp_enqueue_style ( 'astronomy-sidebarright' ); } else { echo ''; } } else if ( is_search() ) { if ( $astronomy_general_layout == "option1" or empty( $astronomy_general_layout ) ) { echo ''; } else if ( $astronomy_general_layout == "option2" ) { wp_enqueue_style ( 'astronomy-sidebarleft' ); } else if ($astronomy_general_layout == "option3") { wp_enqueue_style ( 'astronomy-sidebarright' ); } } } add_action( 'wp_enqueue_scripts', 'astronomy_sidebar_css', '11' ); /* Add Custom Sidebar html */ function astronomy_sidebar_html() { // Get theme options values. $astronomy_homepage_layout = astronomy_var ( 'astronomy_homepage_layout' ); $astronomy_general_layout = astronomy_var ( 'astronomy_general_layout' ); $astronomy_blog_layout = astronomy_var ( 'astronomy_blog_layout' ); $astronomy_post_layout = astronomy_var ( 'astronomy_post_layout' ); $astronomy_portfolio_layout = astronomy_var ( 'astronomy_portfolio_layout' ); $astronomy_project_layout = astronomy_var ( 'astronomy_project_layout' ); $astronomy_woocommerce_layout = astronomy_var ( 'astronomy_woocommerce_layout' ); $astronomy_woocommerce_layoutproduct = astronomy_var ( 'astronomy_woocommerce_layoutproduct' ); do_action('astronomy_sidebar_html'); if ( is_front_page() ) { if ( $astronomy_homepage_layout == "option1" or empty( $astronomy_homepage_layout ) ) { echo ''; } else if ( $astronomy_homepage_layout == "option2" ) { echo get_sidebar(); } else if ( $astronomy_homepage_layout == "option3" ) { echo get_sidebar(); } } else if ( is_page() ) { if ( $astronomy_general_layout == "option1" or empty( $astronomy_general_layout ) ) { echo ''; } else if ( $astronomy_general_layout == "option2" ) { echo get_sidebar(); } else if ( $astronomy_general_layout == "option3" ) { echo get_sidebar(); } } else if ( astronomy_check_isblog() and ! is_single() and ! is_post_type_archive( 'portfolio' ) and ! is_post_type_archive( 'product' ) ) { if ( $astronomy_blog_layout == "option1" or empty( $astronomy_blog_layout ) ) { echo ''; } else if ( $astronomy_blog_layout == "option2" ) { echo get_sidebar(); } else if ( $astronomy_blog_layout == "option3" ) { echo get_sidebar(); } } else if ( is_post_type_archive( 'portfolio' ) ) { if ( $astronomy_portfolio_layout == "option1" or empty( $astronomy_portfolio_layout ) ) { echo ''; } else if ( $astronomy_portfolio_layout == "option5" or $astronomy_portfolio_layout == "option7" ) { echo get_sidebar(); } else if ( $astronomy_portfolio_layout == "option6" or $astronomy_portfolio_layout == "option8" ) { echo get_sidebar(); } else { echo ''; } } else if ( is_post_type_archive( 'product' ) or is_tax( 'product_cat' ) or is_tax( 'product_tag' ) ) { if ( $astronomy_woocommerce_layout == "option1" or empty( $astronomy_woocommerce_layout ) ) { echo ''; } else if ( $astronomy_woocommerce_layout == "option5" or $astronomy_woocommerce_layout == "option7" ) { echo get_sidebar(); } else if ( $astronomy_woocommerce_layout == "option6" or $astronomy_woocommerce_layout == "option8" ) { echo get_sidebar(); } else { echo ''; } } else if ( is_singular( 'post' ) ) { if ( $astronomy_post_layout == "option1" or empty( $astronomy_post_layout ) ) { echo ''; } else if ( $astronomy_post_layout == "option2" ) { echo get_sidebar(); } else if ( $astronomy_post_layout == "option3" ) { echo get_sidebar(); } else { echo ''; } } else if ( is_singular( 'portfolio' ) ) { if ( $astronomy_project_layout == "option1" or empty( $astronomy_project_layout ) ) { echo ''; } else if ( $astronomy_project_layout == "option2" ) { echo get_sidebar(); } else if ( $astronomy_project_layout == "option3" ) { echo get_sidebar(); } else { echo ''; } } else if ( is_singular( 'product' ) ) { if ( $astronomy_woocommerce_layoutproduct == "option1" or empty( $astronomy_woocommerce_layoutproduct ) ) { echo ''; } else if ( $astronomy_woocommerce_layoutproduct == "option2" ) { echo get_sidebar(); } else if ( $astronomy_woocommerce_layoutproduct == "option3" ) { echo get_sidebar(); } else { echo ''; } } else if ( is_search() ) { if ( $astronomy_general_layout == 'option1' or empty( $astronomy_general_layout ) ) { echo ''; } else if ( $astronomy_general_layout == "option2" ) { get_sidebar(); } else if ( $astronomy_general_layout == "option3" ) { get_sidebar(); } } } /* ---------------------------------------------------------------------------------- Select a Sidebar ---------------------------------------------------------------------------------- */ /* Add Selected Sidebar To Specific Pages */ function astronomy_input_sidebars() { // Get theme options values. $astronomy_general_sidebars = astronomy_var ( 'astronomy_general_sidebars' ); $astronomy_homepage_sidebars = astronomy_var ( 'astronomy_homepage_sidebars' ); $astronomy_blog_sidebars = astronomy_var ( 'astronomy_blog_sidebars' ); $astronomy_post_sidebars = astronomy_var ( 'astronomy_post_sidebars' ); $astronomy_portfolio_sidebars = astronomy_var ( 'astronomy_portfolio_sidebars' ); $astronomy_project_sidebars = astronomy_var ( 'astronomy_project_sidebars' ); $astronomy_woocommerce_sidebars = astronomy_var ( 'astronomy_woocommerce_sidebars' ); $astronomy_woocommerce_sidebarsproduct = astronomy_var ( 'astronomy_woocommerce_sidebarsproduct' ); if ( is_front_page() ) { $output = $astronomy_homepage_sidebars; } else if ( is_page() ) { $output = $astronomy_general_sidebars; } else if ( astronomy_check_isblog() and ! is_single() and ! is_post_type_archive( 'portfolio' ) and ! is_post_type_archive( 'product' ) ) { $output = $astronomy_blog_sidebars; } else if ( is_post_type_archive( 'portfolio' ) ) { $output = $astronomy_portfolio_sidebars; } else if ( is_post_type_archive( 'product' ) or is_tax( 'product_cat' ) or is_tax( 'product_tag' ) ) { $output = $astronomy_woocommerce_sidebars; } else if ( is_singular( 'post' ) ) { $output = $astronomy_post_sidebars; } else if ( is_singular( 'portfolio' ) ) { $output = $astronomy_project_sidebars; } else if ( is_singular( 'product' ) ) { $output = $astronomy_woocommerce_sidebarsproduct; } else if ( is_search() ) { $output = $astronomy_general_sidebars; } if ( empty( $output ) or $output == 'Select a sidebar:' ) { $output = 'Sidebar'; } return $output; } /* ---------------------------------------------------------------------------------- Intro Default options ---------------------------------------------------------------------------------- */ /* Add custom intro section [Extend for more options in future update] */ function astronomy_custom_intro() { $class_intro = NULL; if ( ! is_front_page() ) { // If no breadcrumbs are available on current page then change intro class to option1 if ( astronomy_input_breadcrumbswitch() == '' ) { $class_intro = 'option1'; } // Output intro with breadcrumbs if set echo '
', '

', astronomy_title_select(), '

', astronomy_input_breadcrumbswitch(), '
'; } // Hook to after content after intro (e.g. WooCommerce intro) do_action('astronomy_hook_custom_intro'); } //Output header above slider - Astronomy specific function astronomy_custom_introabove() { astronomy_custom_intro(); } /* ---------------------------------------------------------------------------------- Enable Breadcrumbs ---------------------------------------------------------------------------------- */ /* Toggle Breadcrumbs */ function astronomy_input_breadcrumbswitch() { // Get theme options values. $astronomy_general_breadcrumbswitch = astronomy_var ( 'astronomy_general_breadcrumbswitch' ); if( ! is_front_page() ) { if ( $astronomy_general_breadcrumbswitch == '1' ) { return astronomy_input_breadcrumb(); } } } /* ---------------------------------------------------------------------------------- Enable Responsive Layout ---------------------------------------------------------------------------------- */ /* http://wordpress.stackexchange.com/questions/27497/how-to-use-wp-nav-menu-to-create-a-select-menu-dropdown */ class astronomy_nav_menu_responsive extends Walker_Nav_Menu{ function start_el(&$output, $item, $depth=0, $args=array(), $id = 0) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); $class_names = ' class="' . esc_attr( $class_names ) . '"'; $output .= $indent . '
  • '; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_url( $item->url ) .'"' : ''; // Insert title for top level $title = ( $depth == 0 ) ? '' . apply_filters( 'the_title', $item->title, $item->ID ) . '' : apply_filters( 'the_title', $item->title, $item->ID ); // Insert sub-menu titles if ( $depth > 0 ) { $title = str_repeat('- ', $depth ) . esc_html( $item->title ); } // Structure of output $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . $title . $args->link_after; $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } } // Fallback responsive menu when custom header menu has not been set. function astronomy_input_responsivefall() { $output = wp_list_pages('echo=0&title_li='); echo ''; } function astronomy_input_responsivehtml1() { // Get theme options values. $astronomy_general_fixedlayoutswitch = astronomy_var ( 'astronomy_general_fixedlayoutswitch' ); if ( $astronomy_general_fixedlayoutswitch !== '1' ) { echo ''; } } function astronomy_input_responsivehtml2() { // Get theme options values. $astronomy_general_fixedlayoutswitch = astronomy_var ( 'astronomy_general_fixedlayoutswitch' ); if ( $astronomy_general_fixedlayoutswitch !== '1' ) { $args = array( 'container_class' => 'responsive-links nav-collapse collapse', 'container_id' => 'header-responsive-inner', 'menu_class' => '', 'theme_location' => 'header_menu', 'walker' => new astronomy_nav_menu_responsive(), 'fallback_cb' => 'astronomy_input_responsivefall', ); echo '
    ', wp_nav_menu( $args ), '
    '; } } function astronomy_input_responsivecss() { // Get theme options values. $astronomy_general_fixedlayoutswitch = astronomy_var ( 'astronomy_general_fixedlayoutswitch' ); if ( $astronomy_general_fixedlayoutswitch !== '1' ) { wp_enqueue_style ( 'astronomy-responsive' ); } } add_action( 'wp_enqueue_scripts', 'astronomy_input_responsivecss', '12' ); function astronomy_input_responsiveclass($classes){ // Get theme options values. $astronomy_general_fixedlayoutswitch = astronomy_var ( 'astronomy_general_fixedlayoutswitch' ); if ( $astronomy_general_fixedlayoutswitch == '1' ) { $classes[] = 'layout-fixed'; } else { $classes[] = 'layout-responsive'; } return $classes; } add_action( 'body_class', 'astronomy_input_responsiveclass'); /* ---------------------------------------------------------------------------------- Custom CSS ---------------------------------------------------------------------------------- */ /* Add Custom CSS */ function astronomy_custom_css() { // Get theme options values. $astronomy_general_customcss = astronomy_var ( 'astronomy_general_customcss' ); if ( ! empty( $astronomy_general_customcss ) ) { echo "\n" .'' . "\n"; } } add_action( 'wp_head','astronomy_custom_css', '12' ); ?>