Forums / General Questions / Need to only show in one category

Need to only show in one category

Started by 4jdesigns on 30 May 2012, 11:12 AM · Views: 474

Results 1 to 2 of 2
30 May 2012, 11:12 AM
#1
4jdesigns avatar

4jdesigns

Zen Follower

Join Date:
Jul 2011
Posts:
106
Plugin Contributions:
0

Need to only show in one category

Hi All,

I am needing to only show a specific fields in a specific category on my product listings page, I have played around a bit but without any luck.

I have been trying a bit with:

<?php
if ($categories_name = 'Washing Machines') { ?>
<div>show this thing</div>
<?php } elseif  ($categories_name = 'Fridges')  { ?>
<div>show that thing</div>
<?php } else { ?>
<div>Don't show anything</div>
<?php } ?>

Any help would be greatly appreciated.

Jay

30 May 2012, 11:40 AM
#2
4jdesigns avatar

4jdesigns

Zen Follower

Join Date:
Jul 2011
Posts:
106
Plugin Contributions:
0

Re: Need to only show in one category

SOLVED!!!

I went about it the wrong way, I used the ID instead:

<?php
if ($current_category_id = '[I]category id number[/I]') { ?>
<div>show this thing</div>
<?php } elseif  ($current_category_id = '[I]other category id number[/I]')  { ?>
<div>show that thing</div>
<?php } else { ?>
<div>Don't show anything</div>
<?php } ?>

Not sure if it helps anyone else, but allowed me to place specifics into the product listing for specific categories.