Reputation: 447
I am trying to hide a WordPress widget from homepage but need to show on post and page. I am using this:
if ( is_active_sidebar( 'sidebar-2' ) && !(is_home) : ?>
But this is showing an error:
Parse error: syntax error, unexpected ':' in C:\xampp\htdocs\wordpress\wp-content\themes\Features\sidebar-main.php on line 11
Upvotes: 0
Views: 675
Reputation: 408
You are using the incorrect conditions. You have to use
if ( is_active_sidebar( 'sidebar-2' ) && !is_home() ){}
You can also use Widget Options
to hide WordPress widgets without editing the code and available on the repository for free. The options will be visible on each widgets. Feel free to check.
Upvotes: -1
Reputation: 1223
Is_home is a function - so you need a couple of parentheses at the end of it - like so: is_home()
. You also appear to be missing a bracket at the end of the line; your if-statement should read like this:
if ( is_active_sidebar( 'sidebar-2' ) && !is_home() )
Upvotes: 2
Reputation: 945
you are missing a closing bracket, try this:
if ( is_active_sidebar( 'sidebar-2' ) && !(is_home)) : ?>
Upvotes: 2