Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1338819
    bradmaclean
    Participant

    Hello,
    I’m trying to add a sidebar to the single post pages only, keeping full-width on my main blog page (aka. blog index page?). Is this possible? I’ve searched the forum top to bottom but could only find a solution for the opposite – keeping on blog page and removing from single post pages. Any help you can provide would be greatly appreciated.

    Also, is it possible to add sections/content bands to the bottom of all my post pages? It would be hugely beneficial if I had a standard set of sections (created in cornerstone preferably) with my preferred columns/rows and elements that appeared across all my post pages, (aka. as part of the post page template.)

    oh, one last thing – how can I display the breadcrumb bar on only my Blog pages – the main blog index page and the individual post pages; and hidden everywhere else? Let me know if you’d like me to submit a separate support request for this one.

    here is a link to my main blog page: http://w2worg.wpengine.com/news-blog/ (note: this page should not have the side bar, as it shows, but the post pages it links to should have the side bar, which is where i need your help :-)).

    Thanks so much in advance for your help!
    Brad

    #1339098
    Rad
    Moderator

    Hi there,

    Thanks for posting in.

    1. Please add this code to your child theme’s functions.php

     function x_get_content_layout() {
    
        $content_layout = x_get_option( 'x_layout_content' );
    
        if ( $content_layout != 'full-width' ) {
          if ( 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' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            } else {
              $opt    = x_get_option( 'x_archive_layout' );
              $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' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( x_is_buddypress() ) {
            $opt    = x_get_option( 'x_buddypress_layout_content' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_404() ) {
            $layout = 'full-width';
          } else {
            $layout = $content_layout;
          }
        } else {
          $layout = $content_layout;
        }
    
          if ( is_home() ) {        
            $layout = 'full-width';
          } elseif ( is_singular( 'post' ) ) {
            $layout = 'content-sidebar';
          }
    
        return $layout;
    
      }

    This should set your single post to content-sidebar layout, while blog home page is full-width.

    2. Blog home page is basically an archive page, once you assign a page as your blog posts page then it will no longer function as a page, but just an archive page (it only uses the URL and page name of the page you assigned). Maybe adding content is possible, but the functionality of a page isn’t possible.

    3. You can enable breadcrumb in your customizer ( Admin > Appearance > Customizer > Header > MISCELLANEOUS > Breadcrumbs ), then add this custom CSS in Admin > Appearance > Customizer > Custom > CSS

    .x-breadcrumb-wrap {
    display: none;
    }
    
    .blog .x-breadcrumb-wrap, .single-post .x-breadcrumb-wrap {
    display: block;
    }

    Hope these helps.

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