List posts from custom post type with custom taxonomies categories and tags
-
Hi there,
I’m doing a multiple portfolios project with categories, artists and I have an issue…
I’ve made a custom post type with custom taxonomies and custom tag :
Here are fields:
– Title: Project title
– Custom taxonomy 1: Projet categories (cat1, cat2)
– Custom taxonomy 2: Artist (artist1, artist2, etc…)
– Custom tag: Izotope portfolio filters (All, tag1, tag2, tag3, etc…)
I can’t reach to display Izotope portfolio filters (tags) that correspond to posts and selected Artist.For example:
My parent page (page-template.php) displays all artists which belong to cat1.
Clic on an artist -> list artist’s projects with tag filters (taxonomy-portfolio_artist.php).
If I choose another artist, it display same filters, not filters which belong to this artist posts (projects).Here is my taxonomy-portfolio_artist.php code :
<?php get_header(); ?> <header class="page-header clr"> <h1 class="page-header-title"><?php echo single_term_title(); ?></h1> <?php $posttype_obj = get_post_type_object( get_post_type( ) ); ?> <?php $portfolio_terms = get_terms( 'portfolio_tag', array( 'orderby' => 'name', 'order' => 'ASC' ) ); ?> <?php if ( $portfolio_terms ) { ?> <ul class="tax-archives-filter clearfix"> <li class="project-filter"><a href="<?php echo get_post_type_archive_link( $post->post_type ); ?>" title="<?php echo $posttype_obj->label; ?>" class="active"><?php _e('ALL','wpex'); ?></a></li> <?php foreach( $portfolio_terms as $portfolio_term ) : ?> <li><a href="<?php echo get_term_link( $portfolio_term->slug, 'portfolio_tag'); ?>" title="<?php echo $portfolio_term->name; ?>"><?php echo $portfolio_term->name; ?></a></li> <?php endforeach; ?> </ul><!-- .tax-archives-filter --> <?php } ?> </header><!-- /page-heading --> <?php // The Loop ?> <?php while ( have_posts() ) : the_post(); ?> <?php $categories = get_the_terms( $post->ID , 'portfolio_category' );?> <?php $artists = get_the_terms( $post->ID , 'portfolio_artiste' ); foreach($artists as $artist); foreach($categories as $category); $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?> <a href="<?php echo esc_attr($url)?>" title="<?php echo get_post_meta($post->ID, 'meta_client', true); ?>" rel="lightbox[portfolio-lightbox]"> <article id="post-<?php the_ID(); ?>" <?php post_class('homepost'); ?>> <div class="homepage_post-img"><?php the_post_thumbnail('medium');?></div> <h2 class="projet-title"><?php the_title(); ?></h2> <!--<h2 class="artist-name"><?php echo esc_attr($artist->name)?></h2>--> <h3 class="client-name"><?php echo get_post_meta($post->ID, 'meta_client', true); ?></h3> <h3 class="project-category"><?php echo esc_attr($category->name)?></h3> <p><?php the_content(); ?></p> </article><!-- #post-<?php the_ID(); ?> --> </a> <?php endwhile; // end of the loop. ?> <?php get_footer(); ?>
Any help would be appreciated.
- The topic ‘List posts from custom post type with custom taxonomies categories and tags’ is closed to new replies.