is_page_template()
function to check whether you’re using a particular or not. You can read about how it works in the Developer Reference. An example of this would be:
if ( true === is_page_template( 'xyz.php' ); ) {
get_sidebar();
}
Although if your templates are selectable from the edit page screen in the Page Attributes section (where you edit the page content), then simply having two separate templates, one with a sidebar and one without would be fine. No need for an if statement like above.
]]>I need to disable the sidebar on the front-page.php for the no-sidebar.php template ONLY and leave the sidebar in place for default templates.
]]>
<?php if(is_home() && is_front_page()): ?>
<?php endif; ?>
Thanks.
]]>The front-page with the no-sidebar template applied now has no sidebar, however it is not pulling in the full width aspect of the no-sidebar page template now ??
]]> <?php if (is_page_template('front-page.php' && 'no-sidebar.php') ) : ?>
<div id="primary" class="content-area-no-sidebar">
<main id="main" class="site-main">
<?php else : ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php endif; ?>
I don’t know how best practice this is but it works!
Thanks everyone.
]]>