Tagged: Advanced Customization, BoldGrid Themes
- AuthorPosts
- July 7, 2022 at 6:40 am #55069Crystal JonesGuest
I created a custom template called single-campaigns.php. It is in my child template folder (boldgrid-hifidel-child). This is the code in my custom template:
<?php /** * The core template of a BoldGrid theme. If there's no home template * then this template gets used. One of two required WordPress files. * * @since 2.0 * * @package Prime */ if ( ! have_posts() ) : get_template_part( 'templates/content', 'none' ); endif; if ( is_archive() ) : get_template_part( 'templates/entry-header', 'archive' ); endif; while ( have_posts() ) : the_post(); get_template_part( 'templates/content', get_post_type() !== 'post' ? get_post_type() : get_post_format() ); endwhile; boldgrid_paging_nav();
Following the instructions on this post: https://www.boldgrid.com/support/question/5181-how-can-i-disable-the-sidebar-for-a-template/, I added the following code snippet (using the Snippets plugin) to disable the sidebars:
function my_custom_theme_configs( $boldgrid_framework_configs ) { $boldgrid_framework_configs['template']['sidebar'][] = "is_single"; $boldgrid_framework_configs['template']['sidebar'][] = "[single-campaign.php]is_page_template"; return $boldgrid_framework_configs; } add_filter( 'boldgrid_theme_framework_config', 'my_custom_theme_configs');
My sidebars are still in place. I am stuck what to do to remove the sidebars for my custom template.
July 7, 2022 at 2:25 pm #55089Brandon CKeymasterHi Crystal,
Thanks so much for reaching out and thank you for using the BoldGrid Hifidel theme with BoldGrid Post and Page Builder for WordPress!
Can you please send us the URL to one of your pages where you are using your custom template. We’d like to inspect the page just make sure that it is recognizing the custom post type. It’s possible that your code is correct but WordPress is not is not loading the new post type properly.
You also want to check that your Crio child theme is your active theme and not Crio itself.
We look forward to assisting you further with this!
- AuthorPosts
- The topic ‘How Can I Disable The Sidebar Only For A Specific Custom Template?’ is closed to new replies.