Reputation: 389
I'm trying to remove the sidebar from my archive.php category page in WordPress. The problem is that the sidebar is included in the footer file, so I need to create a conditional statement to detect what pages are category pages. The if statement in the footer.php file reads:
<?php if(!is_page_template('page-full.php') && (basename($_SERVER['SCRIPT_FILENAME'])!='wp-signup.php')) : ?>
</div><!-- end content -->
<?php get_sidebar(); ?>
<?php endif; ?>
I tried to add if(!is_category()) to the statement (shown bellow), but it seems to break the whole statement. Am I doing something wrong here?
<?php if(!is_category() || (!is_page_template('page-full.php') && (basename($_SERVER['SCRIPT_FILENAME'])!='wp-signup.php')) : ?>
</div><!-- end content -->
<?php get_sidebar(); ?>
<?php endif; ?>
Upvotes: 0
Views: 938
Reputation: 1
Firstly the piece of modified code you provided was missing an end bracket, that might the reason for it to break.
Secondly, you should be using an && operator if you want to allow existing conditional criteria to display sidebar, so the below modified if statement might work
<?php if(!is_category() && !is_page_template('page-full.php') && (basename($_SERVER['SCRIPT_FILENAME'])!='wp-signup.php')) : ?>
Hope it helps
Upvotes: 0
Reputation: 146201
You may try this (don't show sidebar
on category
and single
page, or/||
won't work)
<?php if(!is_category() && !is_single() ) : ?>
</div><!-- end content -->
<?php get_sidebar(); ?>
<?php endif; ?>
This will show sidebar
if neither category
nor single
page.
Upvotes: 1