• Resolved hobojoe

    (@hobojoe)


    Hi all. I’ve been wondering around these forums for the last few days just trying to figure out how I could display the category title before getting into the loop. I’ve seen a lot of posts about this with no solutions…So I finally thought about it and came to a conclusion. This has worked for me (so far) so I figured I would post it here for everyone.

    <?php $category_id = $wp_query->query_vars[‘product_category’];
    if($category_id){
    $category_name = $wpdb->get_var(“SELECT name FROM ".$wpdb->prefix."product_categories WHERE id='”.$category_id.”‘”);
    }
    echo $category_name; ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • If it is a category archive you can also use single_cat_title();

    Thread Starter hobojoe

    (@hobojoe)

    That is also good to know.

    Hopefully these solutions will help someone in need 🙂

    Thread Starter hobojoe

    (@hobojoe)

    Oh wow I just realized where I posted this…This is for the WP e-Commerce plugin ! Mod if you could delete or move this thread that would be great.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Showing the Category’ is closed to new replies.