WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Navigation List -is it that hard? (9 posts)

  1. whipd09
    Member
    Posted 4 years ago #

    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
    VISUALISATION

    For the life of me, I can't seem to find a solution to this?

  2. wprelief
    Member
    Posted 4 years ago #

    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.

  3. whipd09
    Member
    Posted 4 years ago #

    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.

  4. whipd09
    Member
    Posted 4 years ago #

    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.

  5. wprelief
    Member
    Posted 4 years ago #

    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?

    From here: http://stackoverflow.com/questions/1155565/query-multiple-custom-taxonomy-terms-in-wordpress-2-8/2060777#2060777

    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?

  6. whipd09
    Member
    Posted 4 years ago #

    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?

  7. whipd09
    Member
    Posted 4 years ago #

  8. wprelief
    Member
    Posted 4 years ago #

    What 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/

  9. whipd09
    Member
    Posted 4 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic