Blog post : How to create/edit the single blog article page/template?

I would like to have my articles look like this
http://demo.theme.co/integrity-1/5-reasons-you-need-the-x-theme/

I need to add more sections on the left part but I cannot find the page/template to edit to achieve this.

thanks

Hello There,

Thanks for writing in! The contents you are referring to is the sidebar. You cannot edit this in Cornerstone because it is not part of the content. What you are seeing in the example url is using text, shortcodes and widgets. You can add or remove any widget by going to Appearance > Widgets. Please find the main sidebar area and you can start inserting or removing widgets for your sidebar. To know more about widgets, please check out this codex: https://codex.wordpress.org/WordPress_Widgets

Hope this helps.

Hi RueNel,

Thanks for your kind reply. I still have a few questions.

  1. I know how widgets work but I was not capable of adding a sidebar for them in my blog page (I tried to use a sidebar page template but it did not work) that is why I wondered if adding a sidebar on my blog pages is something I should do in cornerstone or in the X template ?
  2. I would need to add “blocs” like “comments” or “related posts” right under each blog post - being able to do this within cornerstone would have helped me. What is the alternative ?

Thanks for your help - have a nice weekend.

Hello There,

Thanks for getting back to us.

1.) You may have set your global layout as fullwidth or may have set the blog as fullwidth. This setting will display the single post post or blog index as fullwidth with no sidebar. Even if you add your widgets in the main sidebar area, the sidebar will not display because the site is set to display as fullwidth. If you wouldn’t mind, please send us the url of your site or your blog index so that we can the a closer look.

2.) The comments section below the post can be enabled in the Post Edit Settings. Please check out this codex: https://codex.wordpress.org/Comments_in_WordPress#Turning_on_Comments_for_a_Single_Post_or_Page

If you add related post, you will be needing a 3rd party plugin to display related post items below the post content. Perhaps any of these plugins may help you: https://wordpress.org/plugins/search/related+post/

Hope this helps.

Hello - sure - thanks

Hi there,

If you want to replicate the blog page of Integrity demo where the main blog is fullwidth and the single posts have a sidebar, please do the following:

1. Go to X > Launch > Options > Layout and Design > Content Layout and set it to Content Left, Sidebar Right
2. Go to X > Launch > Options > Blog > Layout and set it to Fullwidth

Hope this helps.

Thank you - yes it works - unfortunately my other content is also impacted (which I dont want)

Hi there,

That’s a search result page, should it display content-sidebar while blog is full-width? If yes, you have to override it through this code, 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 ( is_home() ) {
        $opt    = x_get_option( 'x_blog_layout' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_singular( 'post' ) ) {
        $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
        $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
      } 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' );
          $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_search() ) {
return 'content-sidebar';
}
    return $layout;

  }

Thanks!

Thanks for your efforts but it will be the versus

Blog -> show sidebar

Search results (and rest of the site) -> full width

Thaks

In that case, please change code to this.

function x_get_content_layout() {

    $content_layout = x_get_option( 'x_layout_content' );

    if ( $content_layout != 'full-width' ) {
      if ( is_home() ) {
        $opt    = x_get_option( 'x_blog_layout' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_singular( 'post' ) ) {
        $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
        $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
      } 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' );
          $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_search() ) {
return 'full-width';
}
    return $layout;
1 Like

Hello Paul,

Thanks for your help - unfortunately the blog is displaying an empty page (on whole site) if I add this code to the child-theme function.php.

Can you look if there is a typo ?

Thank you

Hi,

Sorry there is a missing close bracket at the end.

This is the correct code.

function x_get_content_layout() {

    $content_layout = x_get_option( 'x_layout_content' );

    if ( $content_layout != 'full-width' ) {
      if ( is_home() ) {
        $opt    = x_get_option( 'x_blog_layout' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_singular( 'post' ) ) {
        $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
        $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
      } 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' );
          $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_search() ) {
return 'full-width';
}
    return $layout;
  }

Thanks

Still not good - you can test it on our site (I can give you ftp access to add the code if needed)
for the moment - I tested it and had to remove it as it was not working.

Let me know - cheers !

Hi there,

Yes kindly provide the FTP details of your site so that we can test it.

Thank you.