$ _GET和永久链接问题

I have a permalink like so /products-page/custom/test-product/

the custom is my products category, test-product is the product name and products-page is the page name.

In php I am trying to GET the category name like so

if($_GET['wpsc_product_category'] == "Custom"){ 
//do something
}

but the code above does not work...is there away to grab the custom with get even thought my permalink looks weird?

You're going to have to change around some stuff in .htaccess. $_GET is designed with permalinks like index.php?wpsc_product_category=Custom and such. Take a look at this post.

Original Answer: How to get the category title in a post in Wordpress?

Haven't tested it.

foreach (get_the_category() as $category) {
  if ( $category->cat_name == 'custom') {
    // Do something
  }
} 

This worked for me

<?php $category = wpsc_the_product_permalink();
                                  $categoryname = explode("/", $category);

                                  if(!$categoryname[4]){ ?>