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 = get_option( 'attire_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() || is_front_page() ) { // 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() ) { // else post meta is is the top priority $meta = maybe_unserialize( get_post_meta( $post->ID, 'attire_post_meta', true ) ); // echo '
' . json_encode( $meta, JSON_PRETTY_PRINT ) . ''; $page_layout['sidebar_layout'] = esc_attr( $theme_mod['layout_default_page'] ); $page_layout['left_sidebar'] = esc_attr( $theme_mod['default_page_ls'] ); $page_layout['right_sidebar'] = esc_attr( $theme_mod['default_page_rs'] ); $page_layout['left_sidebar_width'] = intval( $theme_mod['default_page_ls_width'] ); $page_layout['right_sidebar_width'] = intval( $theme_mod['default_page_rs_width'] ); $sidebar_layout = isset( $meta['sidebar_layout'] ) && $meta['sidebar_layout'] !== '' ? $meta['sidebar_layout'] : $page_layout['sidebar_layout']; $left_sidebar = isset( $meta['left_sidebar'] ) && $meta['left_sidebar'] !== 'default' ? $meta['left_sidebar'] : $page_layout['left_sidebar']; $right_sidebar = isset( $meta['right_sidebar'] ) && $meta['right_sidebar'] !== 'default' ? $meta['right_sidebar'] : $page_layout['right_sidebar']; $left_sidebar_width = isset( $meta['left_sidebar_width'] ) && (int) $meta['left_sidebar_width'] !== 0 ? $meta['left_sidebar_width'] : $page_layout['left_sidebar_width']; $right_sidebar_width = isset( $meta['right_sidebar_width'] ) && (int) $meta['right_sidebar_width'] !== 0 ? $meta['right_sidebar_width'] : $page_layout['right_sidebar_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 ); ?> 'right-sidebar-1', 'left_sidebar_width' => 3, 'right_sidebar_width' => 3 ); if ( is_home() || is_front_page() ) { $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() ) { $meta = maybe_unserialize( get_post_meta( $post->ID, 'attire_post_meta', true ) ); if ( is_page() ) { $page_layout['sidebar_layout'] = esc_attr( $theme_mod['layout_default_page'] ); $page_layout['left_sidebar_width'] = intval( $theme_mod['default_page_ls_width'] ); $page_layout['right_sidebar_width'] = intval( $theme_mod['default_page_rs_width'] ); $page_layout['page_width'] = intval( $theme_mod['default_page_rs_width'] ); } else { $page_layout['sidebar_layout'] = esc_attr( $theme_mod['layout_default_post'] ); $page_layout['left_sidebar_width'] = intval( $theme_mod['default_post_ls_width'] ); $page_layout['right_sidebar_width'] = intval( $theme_mod['default_post_rs_width'] ); } $sidebar_layout = isset( $meta['sidebar_layout'] ) && $meta['sidebar_layout'] != '' ? $meta['sidebar_layout'] : $page_layout['sidebar_layout']; $left_sidebar_width = isset( $meta['left_sidebar_width'] ) && $meta['left_sidebar_width'] != '' ? $meta['left_sidebar_width'] : $page_layout['left_sidebar_width']; $right_sidebar_width = isset( $meta['right_sidebar_width'] ) && $meta['right_sidebar_width'] != '' ? $meta['right_sidebar_width'] : $page_layout['right_sidebar_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 ) ); } }