/**
  * Retrieve the sidebar settings for the current post.
  * 
  * @param string $setting
  * @return string
  * @since 1.0.0
  */
 function yit_get_sidebar_setting()
 {
     global $post, $yit_sidebar_layout;
     global $wp_query;
     $post_id = yit_post_id();
     if (empty($post_id) || is_category() || is_archive() || is_search()) {
         $yit_sidebar_layout = yit_get_standard_sidebar();
         return;
     } else {
         $sidebar_layout = yit_get_post_meta($post_id, '_sidebar-layout');
         if (!empty($sidebar_layout) && isset($sidebar_layout['sidebar']) && $sidebar_layout['sidebar'] != -1 || isset($sidebar_layout["layout"]) && $sidebar_layout["layout"] == 'sidebar-no') {
             $yit_sidebar_layout = $sidebar_layout;
         } else {
             $yit_sidebar_layout = yit_get_standard_sidebar();
         }
     }
 }
Exemplo n.º 2
0
    /**
     * Retrieve the sidebar settings for the current post.
     *
     * @param string $setting
     * @return string
     * @since 1.0.0
     */
    function yit_get_sidebar_setting() {
        global $post, $yit_sidebar_layout;

        global $wp_query;

        $post_id = isset( $post->ID ) ? $post->ID : 0;
        if ( is_posts_page() || is_home() ) $post_id = get_option( 'page_for_posts' );

        if( empty( $post_id ) || is_category() || is_archive() || is_search() ) {
            $yit_sidebar_layout = yit_get_standard_sidebar();
            return;
        } else {
            $sidebar_layout = yit_get_post_meta( $post_id, '_sidebar-layout' );

            if( ( !empty( $sidebar_layout ) && isset( $sidebar_layout['sidebar'] ) && $sidebar_layout['sidebar'] != -1 ) || ( isset( $sidebar_layout["layout"] ) && $sidebar_layout["layout"] == 'sidebar-no' ) )
            { $yit_sidebar_layout = $sidebar_layout; }
            else
            { $yit_sidebar_layout = yit_get_standard_sidebar(); }
        }
    }