Forums / Templates, Stylesheets, Page Layout / Can I disable right sidebar when on a cat page which has subcats?

Can I disable right sidebar when on a cat page which has subcats?

Views: 1,468

Results 1 to 8 of 8
27 Mar 2012, 5:29 PM
#1
dremhmrk2 avatar

dremhmrk2

New Zenner

Join Date:
Jun 2010
Posts:
32
Plugin Contributions:
0

Can I disable right sidebar when on a cat page which has subcats?

I would like my right hand side bar to NOT show up when you are on a category page which lists sub categories.

I currently am able to hide the sidebox on the index page using:

 if ($this_is_home_page == true) { 
$flag_disable_right = true;
$flag_disable_left = false;
}

I have been trying to hide subcats using this code:

// the following IF statement can be duplicated/modified as needed to set additional flags
if ($current_page_base == 'cPath=175') {
     $flag_disable_right = true;
  }

But it's not hiding them.

Any help would be greatly appreciated!

27 Mar 2012, 5:43 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Can I disable right sidebar when on a cat page which has subcats?

The test code you show will never work. $current_page_base will never be a cPath, and tests for a cPath need to use the numeric part (possibly including underscores) without cPath=.

You can use ($current_page_base == 'index' and $cPath == '175') which will apply only to a listing of category 175. This will not be based on whether it holds categories or products, though.

Do you want to affect only certain categories, or just all categories that have or will have subcats?
Unfortunately subcategory listings and product listings are both 'index' pages.

27 Mar 2012, 6:14 PM
#3
dremhmrk2 avatar

dremhmrk2

New Zenner

Join Date:
Jun 2010
Posts:
32
Plugin Contributions:
0

Re: Can I disable right sidebar when on a cat page which has subcats?

gjh42:

The test code you show will never work. $current_page_base will never be a cPath, and tests for a cPath need to use the numeric part (possibly including underscores) without cPath=.

You can use ($current_page_base == 'index' and $cPath == '175') which will apply only to a listing of category 175. This will not be based on whether it holds categories or products, though.

Do you want to affect only certain categories, or just all categories that have or will have subcats?
Unfortunately subcategory listings and product listings are both 'index' pages.

I would be happy manually setting them for each category page I wish to hide.

27 Mar 2012, 6:29 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Can I disable right sidebar when on a cat page which has subcats?

Then you can use

if ($current_page_base == 'index' and in_array($cPath, explode(',', '175,189,213,345_7788,666,501'))) {

listing all the cPaths separated by commas, with no spaces.

27 Mar 2012, 6:52 PM
#5
dremhmrk2 avatar

dremhmrk2

New Zenner

Join Date:
Jun 2010
Posts:
32
Plugin Contributions:
0

Re: Can I disable right sidebar when on a cat page which has subcats?

gjh42:

Then you can use

if ($current_page_base == 'index' and in_array($cPath, explode(',', '175,189,213,345_7788,666,501'))) {

listing all the cPaths separated by commas, with no spaces.

This is the code I've entered:

if ($current_page_base == 'index' and in_array($cPath, explode(',', '175,174'))) {
     $flag_disable_right = true;
  }

and I have put this code into my tpl_index_default.php in my overrides folder, however the sideboxes are still showing up on the 2 categories I entered (174, and 175)

25 Oct 2012, 6:17 PM
#6
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Re: Can I disable right sidebar when on a cat page which has subcats?

If I'd like to hide the right column from all, except home page, ezpages and say one category (id 7)
How would I code that?
Thanks

26 Oct 2012, 1:24 AM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Can I disable right sidebar when on a cat page which has subcats?

if ($this_is_home_page or ($current_page_base == 'page') or ($current_page_base == 'index' and $cPath == '7')) {
  //show right col
} else {
   $flag_disable_right = true;
}
26 Oct 2012, 4:59 PM
#8
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Re: Can I disable right sidebar when on a cat page which has subcats?

Terrific thanks :D