Taxonomy Navigation List -is it that hard?
-
I have a Custom Post type of Portfolio. For Portfolio I have a taxonomy of ‘TypeofProject‘ which basically sorts the portfolio posts into different categories.
In the navigation for the Portfolio section of the website I’d like a list of the Types of Projects(taxonomy) which are linkable. When you click on one it brings up a page of that category’s posts and the navigation has expanded to also show a list of the posts under the type of project.
Eg:
MULTI-RESIDENTIAL
RESIDENTIAL
MASTER PLANNING
EDUCATION
VISUALISATION*click on RESIDENTIAL*
MULTI-RESIDENTIAL
RESIDENTIAL
– Black Residence
– Middelton Residence
– Sutherlands Residence
MASTER PLANNING
EDUCATION
VISUALISATIONFor the life of me, I can’t seem to find a solution to this?
-
So “Portfolio” is a category and “TypeOfProject” is also a category?
Is Type a sub category of portfolio?To make a list of categories that is linkable, just use the wp_list_categories() template tag in a custom template file.
No No sorry, categories was a bad description.
Portfolio is a custom post type.
Type of Project is a taxonomy.
This is using new WordPress 3.0 features of Custom Post Types and custom taxonomies.
I’m currently using this to successfully list the TypeOfProject terms
<?php //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin) $orderby = 'name'; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 1; // 1 for yes, 0 for no $taxonomy = 'typeofproject'; $title = ''; $args = array( 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'taxonomy' => $taxonomy, 'title_li' => $title ); ?> <ul id="port_nav"> <?php wp_list_categories($args); ?> </ul>
I just need to figure out how to display the relative posts under which ever one is active.
I am not sure I understand what you mean by “which ever one is active”, but did WordPress make a provision for taxonomies in the wp_query() functionality?
I found this:
global $wp_query;
query_posts(
array_merge(
array(‘taxonomy’ => ‘technologies’, ‘term’ => array(‘sql’, ‘php’)),
$wp_query->query
)
);This should help you out, no?
Sorry, my programming skills aren’t that advanced. What would that do and would I use that along with the code that I previously mentioned?
Hi guys,
This is what I’m after:
http://skitch.com/whipd/dmcjw/portfolio-navigation.psd-100-group-2-rgb-8What I am curious about is why you don’t just do categories and pull in the posts from the categories themselves.
My previous suggestion would require that you use the wordpress loop with the query_posts() function right before the loop to grab these items from the db.
I also have found this function: http://codex.wordpress.org/Function_Reference/get_taxonomies which retrieves all registered taxonomies. You can then use the code from “Step 2 Get Information About Current Taxonomy Classification” on this page: http://net.tutsplus.com/tutorials/wordpress/introducing-wordpress-3-custom-taxonomies/
Hi wprelief,
If you still have the stamina to deal with my cluelessness I have a more refined post going on here: http://wordpress.org/support/topic/420442?replies=3#post-1588903
- The topic ‘Taxonomy Navigation List -is it that hard?’ is closed to new replies.