WordPress.org

Ready to get started?Download WordPress

Forums

Displaying & filtering custom taxonomies (1 post)

  1. KGarrett
    Member
    Posted 2 years ago #

    I'm customizing a theme I've purchased...I've got a custom post type (ek_portfolio) and a custom taxonomy (ek_portfolio_type) that I'm trying to filter and display. My php knowledge is limited, so I'm hoping someone can help.

    Here's the code that's creating a list of categories to filter:

    $cat_ID = get_post_meta(get_the_ID(), "air_select_category", true);
    			$categories = get_terms('ek_portfolio_type');
    			foreach ($categories as $category)
    			{
    				$cat_name = $category->name;
    				$cat_nicename = $category->slug;
    			?>
    			<li><a class="<?php echo $cat_nicename?>" href="#<?php echo $cat_nicename?>"><?php echo $cat_name?>

    Then, here it's retrieving the content...

    $my_query = new WP_Query("post_type=ek_portfolio");
    while ($my_query->have_posts()) : $my_query->the_post();
    
    $categories = "";
    foreach((get_the_terms('post_type=ek_portfolio', 'ek_portfolio_type' )) as $category) {
        $categories .= $category->slug . ' ';
    }

    For some reason, when I click on the filter, only some of the content displays. Here's the page it's on: http://www.ekceteradesign.com/portfolio/

    For example, when I click on "Labels & Packaging" only 2 of 4 items display. Is there something in the way they're being retrieved that I'm missing? Everything else about the custom post types and taxonomies seem to be working correctly.

Topic Closed

This topic has been closed to new replies.

About this Topic