Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1310980
    Shizuda
    Participant

    Hey everyone,
    just a short question. Is it possible to set the Ethos Blog general site layout to have a sidebar but all posts to have no sidebar and be fullwidth? I don’t want to have to set it for every post individually (because there already are more than 100 posts existing).

    I believe there was an option like that somewhere but I can’t find it anymore and I also couldn’t find anything in the forum so far.

    Thank you in advance!

    #1311326
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! You can have a general layout that has a sidebar and make your blog index to have a fullwidth page with no sidebar. If you want the opposite, you will need a custom code to achieve this.

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Once the child theme is ready, add this code at your child theme’s functions.php file

    if ( ! function_exists( 'x_get_content_layout' ) ) :
      function x_get_content_layout() {
    
        $stack          = x_get_stack();
        $content_layout = x_get_option( 'x_' . $stack . '_layout_content', 'content-sidebar' );
    
        if ( $content_layout != 'full-width' ) {
          if ( is_home() ) {
            $opt    = x_get_option( 'x_blog_layout', 'sidebar' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_singular( 'post' ) ) {
            $layout = 'full-width';
          } elseif ( x_is_portfolio_item() ) {
            $layout = 'full-width';
          } elseif ( x_is_portfolio() ) {
            $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
            $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
          } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
            $layout = 'content-sidebar';
          } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
            $layout = 'sidebar-content';
          } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
            $layout = 'full-width';
          } elseif ( is_archive() ) {
            if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
              $opt    = x_get_option( 'x_woocommerce_shop_layout_content', 'sidebar' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            } else {
              $opt    = x_get_option( 'x_archive_layout', 'sidebar' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            }
          } elseif ( x_is_product() ) {
            $layout = 'full-width';
          } elseif ( x_is_bbpress() ) {
            $opt    = x_get_option( 'x_bbpress_layout_content', 'sidebar' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( x_is_buddypress() ) {
            $opt    = x_get_option( 'x_buddypress_layout_content', 'sidebar' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_404() ) {
            $layout = 'full-width';
          } else {
            $layout = $content_layout;
          }
        } else {
          $layout = $content_layout;
        }
    
        return $layout;
    
      }
    endif;

    if ( ! function_exists( ‘x_get_content_layout’ ) ) :
    function x_get_content_layout() {

    $stack = x_get_stack();
    $content_layout = x_get_option( ‘x_’ . $stack . ‘_layout_content’, ‘content-sidebar’ );

    if ( $content_layout != ‘full-width’ ) {
    if ( is_home() ) {
    $opt = x_get_option( ‘x_blog_layout’, ‘sidebar’ );
    $layout = ( $opt == ‘sidebar’ ) ? $content_layout : $opt;
    } elseif ( is_singular( ‘post’ ) ) {
    $layout = ‘full-width’;
    } elseif ( x_is_portfolio_item() ) {
    $layout = ‘full-width’;
    } elseif ( x_is_portfolio() ) {
    $meta = get_post_meta( get_the_ID(), ‘_x_portfolio_layout’, true );
    $layout = ( $meta == ‘sidebar’ ) ? $content_layout : $meta;
    } elseif ( is_page_template( ‘template-layout-content-sidebar.php’ ) ) {
    $layout = ‘content-sidebar’;
    } elseif ( is_page_template( ‘template-layout-sidebar-content.php’ ) ) {
    $layout = ‘sidebar-content’;
    } elseif ( is_page_template( ‘template-layout-full-width.php’ ) ) {
    $layout = ‘full-width’;
    } elseif ( is_archive() ) {
    if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
    $opt = x_get_option( ‘x_woocommerce_shop_layout_content’, ‘sidebar’ );
    $layout = ( $opt == ‘sidebar’ ) ? $content_layout : $opt;
    } else {
    $opt = x_get_option( ‘x_archive_layout’, ‘sidebar’ );
    $layout = ( $opt == ‘sidebar’ ) ? $content_layout : $opt;
    }
    } elseif ( x_is_product() ) {
    $layout = ‘full-width’;
    } elseif ( x_is_bbpress() ) {
    $opt = x_get_option( ‘x_bbpress_layout_content’, ‘sidebar’ );
    $layout = ( $opt == ‘sidebar’ ) ? $content_layout : $opt;
    } elseif ( x_is_buddypress() ) {
    $opt = x_get_option( ‘x_buddypress_layout_content’, ‘sidebar’ );
    $layout = ( $opt == ‘sidebar’ ) ? $content_layout : $opt;
    } elseif ( is_404() ) {
    $layout = ‘full-width’;
    } else {
    $layout = $content_layout;
    }
    } else {
    $layout = $content_layout;
    }

    return $layout;

    }
    endif;

    We would love to know if this has work for you.

  • <script> jQuery(function($){ $("#no-reply-1310980 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>