post_title ); endif; rewind_posts(); echo wp_kses_post( apply_filters( "attire_page_heading_main", $PgaeHeadingMain ) ); } /** * @usage Render Dynamic Sidebars */ public static function DynamicSidebars( $pos ) { global $post; $theme_mod = WPATTIRE()->theme_options; $left_sidebar_style = "default"; $right_sidebar_style = "default"; // Defaults $sidebar_layout = 'right-sidebar-1'; $left_sidebar = 'left'; $right_sidebar = 'right'; $left_sidebar_width = 3; $right_sidebar_width = 3; if ( is_home() ) { // if is_home() || is_front_page() default theme option is the top priority $sidebar_layout = esc_attr( $theme_mod['layout_front_page'] ); $left_sidebar = esc_attr( $theme_mod['front_page_ls'] ); $right_sidebar = esc_attr( $theme_mod['front_page_rs'] ); $left_sidebar_width = intval( $theme_mod['front_page_ls_width'] ); $right_sidebar_width = intval( $theme_mod['front_page_rs_width'] ); } elseif ( is_page() ) { $meta = get_post_meta( get_the_ID(), 'attire_post_meta', true ); $sl = isset($meta['sidebar_layout']) ? $meta['sidebar_layout'] : 'default'; $sidebar_layout = $sl === 'default' ? esc_attr( $theme_mod['layout_default_page'] ) : $sl; $theme_mod['layout_default_page'] = $sidebar_layout; $left_sidebar = esc_attr( $theme_mod['default_page_ls'] ); $right_sidebar = esc_attr( $theme_mod['default_page_rs'] ); $left_sidebar_width = intval( $theme_mod['default_page_ls_width'] ); $right_sidebar_width = intval( $theme_mod['default_page_rs_width'] ); } elseif ( is_single() ) { $sidebar_layout = esc_attr( $theme_mod['layout_default_post'] ); $left_sidebar = esc_attr( $theme_mod['default_post_ls'] ); $right_sidebar = esc_attr( $theme_mod['default_post_rs'] ); $left_sidebar_width = intval( $theme_mod['default_post_ls_width'] ); $right_sidebar_width = intval( $theme_mod['default_post_rs_width'] ); } elseif ( is_archive() || is_search() || is_category() ) { $sidebar_layout = esc_attr( $theme_mod['layout_archive_page'] ); $left_sidebar = esc_attr( $theme_mod['archive_page_ls'] ); $right_sidebar = esc_attr( $theme_mod['archive_page_rs'] ); $left_sidebar_width = intval( $theme_mod['archive_page_ls_width'] ); $right_sidebar_width = intval( $theme_mod['archive_page_rs_width'] ); } if ( $pos == 'left' ) { if ( $left_sidebar != 'no_sidebar' && in_array( $sidebar_layout, array( 'left-sidebar-1', 'left-sidebar-2', 'sidebar-2' ) ) ) { self::Sidebar( $left_sidebar, $left_sidebar_width, $left_sidebar_style, "left" ); } elseif ( in_array( $sidebar_layout, array( 'left-sidebar-1', 'left-sidebar-2', 'sidebar-2' ) ) ) { echo '
'; } if ( $right_sidebar != 'no_sidebar' && $sidebar_layout == 'left-sidebar-2' ) { self::Sidebar( $right_sidebar, $right_sidebar_width, $right_sidebar_style, "right" ); } elseif ( $sidebar_layout == 'left-sidebar-2' ) { echo '
'; } } elseif ( $pos == 'right' ) { if ( $left_sidebar != 'no_sidebar' && $sidebar_layout == 'right-sidebar-2' ) { self::Sidebar( $left_sidebar, $left_sidebar_width, $left_sidebar_style, "left" ); } elseif ( $sidebar_layout == 'right-sidebar-2' ) { echo '
'; } if ( $right_sidebar != 'no_sidebar' && in_array( $sidebar_layout, array( 'right-sidebar-1', 'right-sidebar-2', 'sidebar-2' ) ) ) { self::Sidebar( $right_sidebar, $right_sidebar_width, $right_sidebar_style, "right" ); } elseif ( in_array( $sidebar_layout, array( 'right-sidebar-1', 'right-sidebar-2', 'sidebar-2' ) ) ) { echo '
'; } } } /** * @usage Render Sidebar * * @param $id * @param $width * @param $style * @param $pos */ public static function Sidebar( $id, $width, $style, $pos ) { $style = esc_attr( $style ); $pos = esc_attr( $pos ); ?> theme_options; $sidebar_layout = "right-sidebar-1"; $content_width = 12; $right_sidebar_width = 3; $defaults = array( 'sidebar_layout' => 'right-sidebar-1', 'left_sidebar_width' => 3, 'right_sidebar_width' => 3 ); if ( is_home() ) { $sidebar_layout = esc_attr( $theme_mod['layout_front_page'] ); $left_sidebar_width = intval( $theme_mod['front_page_ls_width'] ); $right_sidebar_width = intval( $theme_mod['front_page_rs_width'] ); } elseif ( is_single() || is_page() ) { if ( is_page() ) { $meta = get_post_meta( get_the_ID(), 'attire_post_meta', true ); $sl = isset($meta['sidebar_layout']) ? $meta['sidebar_layout'] : 'default'; $sidebar_layout = $sl === 'default' ? esc_attr( $theme_mod['layout_default_page'] ) : $sl; $theme_mod['layout_default_page'] = $sidebar_layout; $left_sidebar_width = intval( $theme_mod['default_page_ls_width'] ); $right_sidebar_width = intval( $theme_mod['default_page_rs_width'] ); } else { $sidebar_layout = esc_attr( $theme_mod['layout_default_post'] ); $left_sidebar_width = intval( $theme_mod['default_post_ls_width'] ); $right_sidebar_width = intval( $theme_mod['default_post_rs_width'] ); } } elseif ( is_archive() || is_category() || is_search() ) { $sidebar_layout = esc_attr( $theme_mod['layout_archive_page'] ); $left_sidebar_width = intval( $theme_mod['archive_page_ls_width'] ); $right_sidebar_width = intval( $theme_mod['archive_page_rs_width'] ); } if ( $sidebar_layout == "no-sidebar" ) { $content_width = 12; } elseif ( $sidebar_layout == "right-sidebar-1" ) { $content_width = 12 - $right_sidebar_width; } elseif ( $sidebar_layout == "left-sidebar-1" ) { $content_width = 12 - $left_sidebar_width; } else { $content_width = 12 - $left_sidebar_width - $right_sidebar_width; } echo esc_attr( apply_filters( "attire_content_area_width", "$sidebar_layout col-lg-" . $content_width ) ); } }