Tagged: cornerstone
-
AuthorPosts
-
June 9, 2016 at 7:01 pm #1034835
Hello, I have built a dev website utilizing X and Cornerstone to replace an existing website and am getting ready to make the dev site go live but I have a question. How do I apply a blog template I created in Cornerstone on the dev site to all of my already existing blog posts on the live site?
The template can be seen here http://staging.wanderingearl.com/template-demonstration-post/. The actual blog post is input into a text box supplied by the template. How will the existing blog posts be affected? How can I ensure that the hundreds of posts already on the live site (www.wanderingearl.com) display properly when I apply X/Cornerstone to them?
Thanks in advance and your help is appreciated.
June 10, 2016 at 12:31 am #1035334Hi There,
Thanks for writing in! The template you have created in Cornerstone can only be reused when using Cornerstone. This template will not allow your to change the look and feel of any other existing post that you may already have. The sole purpose of the template in Cornerstone is that you can use it later on when creating a new post. And even if you want to edit the template, once you have edited it, it will not automatically update those posts that were using the said template when they were created.
In a simple explanation, the Cornerstone template is like a mold. You can only use the mold to create new molded objects and even if you will redesign the mold, those objects that has been molded can never be updated. Your only option is to scrap the old one and mold again a new one.
Hope this explains it briefly.
June 10, 2016 at 8:44 am #1035859Well, that’s pretty disappointing and had I known that I would have chosen a different method to handle the way the posts display. Is there any way to use sidebars and/or widgets to display content on existing posts?
June 10, 2016 at 11:27 am #1036098Hey There,
Sidebars will be applied globally. So when you add a new widget, it is basically displayed on all the old and new posts.
Hope that helps.
June 10, 2016 at 5:10 pm #1036501Okay perfect, so I can apply a custom sidebar/widget that will appear on each post page? Can you tell me how to do this please?
Thanks!
June 11, 2016 at 12:00 am #1036947Hi there,
Yes, you can go to Admin > Appearance > Sidebars and create your custom sidebar, then assign to post, page, or taxonomy. Once created, simply go to Admin > Appearance > Widgets to add your preferred widgets to your custom sidebar.
Thanks!
June 11, 2016 at 9:11 am #1037345This reply has been marked as private.June 11, 2016 at 5:17 pm #1037644Hi there,
Please add this code to your Child theme’s functions.php with the ID of your created sidebar.
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_home() || is_singular('post') ) return 'content-sidebar'; return $layout; } add_filter( 'ups_sidebar', 'ups_display_sidebar_blog' ); function ups_display_sidebar_blog ( $sidebar ) { return is_home() || is_singular('post') ? 'YOUR-SIDEBAR-ID-HERE' : $sidebar; }
Hope this helps.
June 12, 2016 at 10:33 am #1038284This reply has been marked as private.June 12, 2016 at 1:24 pm #1038456Hi there,
Thanks for writing back. You need to replace YOUR-SIDEBAR-ID-HERE with your sidebar ID (see the line before last).
Hope this makes sense.
Cheers!
June 13, 2016 at 12:03 pm #1039946This reply has been marked as private.June 13, 2016 at 2:24 pm #1040164Hi there,
The code should add the sidebar and the widgets should be present in the sidebar as well if you have added them in Appearance > Widgets.
Let us know if you need further clarification.
June 13, 2016 at 2:40 pm #1040197What I need is a way to change what displays below the content of all the existing and future blog posts (which is what the blog template was supposed to do). The blogger will need to be able to edit this content without editing the PHP of the post pages so Widgets are the obvious choice. However, there is currently no place to display widgets in the area of the page that I need them to display (below the content on the post pages). In Cornerstone it is possible to add a “sidebar” which is not actually displayed like a traditional sidebar (vertically off to the side), it is simply displayed in the main flow of the page and contains easily customizable widgets. This is what I need to be able to add to the post pages. The red circle in the attached image is where the widgets need to display.
I realize that this is outside of what X and Cornerstone are currently setup to do and that I will need to add the widget area(s) in the PHP, I just need guidance where that PHP is and preferably, what that PHP is.
Alternately, the widgets in the footer could be used if (and only if) there is a way to display that particular footer in the post pages.
Thank you and I look forward to hearing from you.
June 13, 2016 at 3:16 pm #1040249This reply has been marked as private.June 14, 2016 at 1:30 am #1040869Hi There,
Thank you for the clarification.
Please add this code on your child theme’s functions.php:register_sidebar( array( 'id' => 'page-bottom', 'name' => __( 'Page - Bottom','x'), 'description' => 'This is the bottom section of the page.', 'before_widget' => '<div id="page-bottom">', 'after_widget' => '</div>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' ) );
Then copy the file content.php from wp-content/themes/x/framework/views/integrity to wp-content/themes/x-child/framework/views/integrity. Open the copied file and then replace the code with the following:
<?php // ============================================================================= // VIEWS/INTEGRITY/CONTENT.PHP // ----------------------------------------------------------------------------- // Standard post output for Integrity. // ============================================================================= ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-featured"> <?php x_featured_image(); ?> </div> <div class="entry-wrap"> <?php x_get_view( 'integrity', '_content', 'post-header' ); ?> <?php x_get_view( 'global', '_content' ); ?> </div> <?php x_get_view( 'integrity', '_content', 'post-footer' ); ?> <?php dynamic_sidebar('page-bottom');?> </article>
Go to Appearance > Widgets. Add the content on Page Bottom Widget Area.
Hope this helps.
-
AuthorPosts