Hiding page title only on product pages of WP-ecommerce plugin while showing in others

Here’s a small tip on how to hide (not display) page titles of WP-ecommerce product pages while showing normal pages titles as usual. In fact i wanted to not display titles, i.e. 1. Products Page and 2. Product Details page.

First i tried get_post_type() to get the post type on page.php template file. Although both of above mentioned pages used the same template.php file to render the products content it would show page when i printed get_post_type(). Perhaps something to do with the short tag [productspage] which i used in the page post. Anyways combination of two statements (shown below) did the trick for me.

<?php
if(get_post_type()!="wpsc-product" && !is_products_page()) { ?>
<h1><?php the_title(); ?></h1>
<?php
}
?>

One thought on “Hiding page title only on product pages of WP-ecommerce plugin while showing in others

Leave a Reply