Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a CPT called campsites and in there I have different categories ie. derbyshire, staffordshire, nottinghamshire etc. What I want to do is that when you click on a category eg. derbyshire, ideally I'd like it to say at the top of the page Campsites in derbyshire.

Please help.

share|improve this question
    
Are you using the category taxonomy specifically, or a custom taxonomy? Please post your register_post_type() code and any applicable, related code (such as register_taxonomy() and/or register_taxonomy_for_object_type(). –  Chip Bennett Nov 26 '12 at 14:18

1 Answer 1

up vote 1 down vote accepted

From what I understand, you just need to use this in your template as it sounds like you will be using an archive page for a given CPT.

<h1><?php post_type_archive_title(); ?></h1>

I've not been able to test this but you can find more info about the options on this Wordpress Codex page.

http://codex.wordpress.org/Function_Reference/post_type_archive_title

There are other solutions based on how your page is going to be displayed so feel free to give more info if this doesn't work.

Based on your comment, you may be able to use a simple tag like this...

<h1><?php echo single_cat_title(); ?></h1>

If it still won't play you may need to go slightly more in depth and I'll need to do that from my main computer later as I have done this same thing recently.

share|improve this answer
    
Hi I just tried that and it didnt work. Basically i want to have the title of the CPT category in this template taxonomy-camps_categories. So for example if someone go in to campsites (CPT) and click on the derbyshire category, it will show all the campsites in derbyshire and i want to have the title at the top saying campsites in derbyshire. Is this possible? –  mandy Nov 26 '12 at 13:49
    
Hi @mandy , check the update above - hopefully it will be this easy. If it is still a no go I'll hook out my solution later. I did this same thing recently ;-) –  shanem Nov 26 '12 at 14:11
    
woop!! all working now :) thank you!! :) –  mandy Nov 26 '12 at 14:55
    
Glad to hear it ;-) –  shanem Nov 27 '12 at 10:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.