I have a custom post type, "entrepreneurs", with a custom taxonomy, "sectors" attached to it. Here is the code (http://codepad.org/ceQH4a6a) for my custom post type registrations.
Things you might need to know:
"Entrepreneurs" are heirachical, like pages.
"Sectors" are like the categories for the post type
What I want to do...
In both my archive and single views, I would like to display the assigned sector name for the post below the title - in the same way that you would in, say, a blog article, using "the_category" or something similar. Like so:
I want the H4 to output the custom taxonomy, without a link - resulting in the following layout (http://db.tt/xiL3w0ty). The grey text below the title is sector taxonomy.
I've tried a number of solutions found on various forums and resources, but none are working for me. Any help would be appreciated.
As this is a "client" website, and they usually screw everything up when editing, I'd prefer to be able to limit the number of terms outputted to 1. Any help..?
Is it possible to modify this so that the term that is output is wrapped in a link that would show the archive of that taxonomy term? (the way a category often is shown)
I have a custom post type, "entrepreneurs", with a custom taxonomy, "sectors" attached to it. Here is the code (http://codepad.org/ceQH4a6a) for my custom post type registrations.
Things you might need to know:
What I want to do...
In both my archive and single views, I would like to display the assigned sector name for the post below the title - in the same way that you would in, say, a blog article, using "the_category" or something similar. Like so:
The full block of code can be found here (http://codepad.org/ub3c9N9P).
I want the H4 to output the custom taxonomy, without a link - resulting in the following layout (http://db.tt/xiL3w0ty). The grey text below the title is sector taxonomy.
I've tried a number of solutions found on various forums and resources, but none are working for me. Any help would be appreciated.
Thanks in advance.
What you need to do is use the terms functions, where you specify the taxonomy you want to use
http://codex.wordpress.org/Function_Reference/get_terms
http://codex.wordpress.org/Function_Reference/wp_get_post_terms
Check the bottom of the pages for more functions too.
I used the following:
It seems to work.
As this is a "client" website, and they usually screw everything up when editing, I'd prefer to be able to limit the number of terms outputted to 1. Any help..?
AFAIK, this is the correct code to use. Yours looks kinda bloated.
Thanks for sharing that. Always good to trim the fat... It worked.
Cheers.
Is it possible to modify this so that the term that is output is wrapped in a link that would show the archive of that taxonomy term? (the way a category often is shown)
http://codex.wordpress.org/Function_Reference/get_term_link
The "Examples" section should be what you're looking for.