Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Need to make a category and products hidden ... wp e-commerce WordPress

  • SOLVED

I'm using the WP e-Commerce (getshopped) plugin and need to hide a category and all products within that category from being viewed on the front-end unless they are given a direct link.

From what I can tell I will need to have the category and products hidden on the front page, the products-page and the product categories menu in the side bar.

The site that I'm working on is [[LINK href="http://designmycart.com/wpdemo/"]]http://designmycart.com/wpdemo/[[/LINK]]

I've created a category named "Hidden" with a test product since I'm sure this will need to be accomplished using a category ID.

I'm open to different methods of accomplishing the goal if you have alternative suggestions.

** I'll up the prize to $25 for anyone that can go in and make the code edits for me. I'm not real worried about hiding the category from the menu since I can do that with CSS but I do need the products hidden from the entire catalog unless viewed from a direct link.

Answers (3)

2012-10-07

Francisco Javier Carazo Gil answers:

For products in the loop you can include a condition like:

$categories = get_the_category();
if($categories){
foreach($categories as $category) {
if($category->cat_name == "Hidden")
$show = false;
}
}

And before: the_title(); the_content(); set:

if($show):
the_title();
the_content();
endif;

All this in the loop (index.php of your theme or different loops, archive.php, search.php, etc.)

Also, to exclude "Hidden" from categories list look for get categories() or wp list categories() and then include in his args the exclude option. You will need to find which is the category id of "Hidden".


Francisco Javier Carazo Gil comments:

If you want, give me FTP access and I will do it. Send me PM.

2012-10-07

Dbranes answers:

mabye this can guide you:

http://docs.getshopped.org/documentation/theme-hacks/

this explains how to exclude a category from products page and how to find the id of the product category you want to hide.


designmycart comments:

I found that doc while searching for a way to do it and that code looks nothing like what I have on the products page. Not sure if that code they show is deprecated or what but it definitely isn't in the newest version of the plugin.


Dbranes comments:

you can PM me and I can have a look at it.

2012-10-08

Arnav Joy answers:

how are you displaying products at front end?