Wordpress display custom post type with custom taxonomy and current term -
difficult one:
i'm trying posts custom post type 'specialisaties' custom taxonomy 'specialismen' , need load current loaded 'term' url.
currently have code outputs term 'superpower' .
<?php $loop = new wp_query(array('post_type'=>'specialisaties', 'taxonomy'=>'specialismen', 'term' => 'superpower', 'orderby' => 'menu_order', 'order' => 'asc')); ?> <?php while ($loop->have_posts()) : $loop->the_post(); ?> <h1><?php the_title() ?></h1> <?php the_content() ?> <?php endwhile; ?>
this loads specific post term 'superpower'. how fetch 'term' dynamically url i'm loading?
thanks in advance,
fixed get_term_by .
<?php $term = get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy') ); ?> <?php $loop = new wp_query(array('post_type'=>'specialisaties', 'taxonomy'=>'specialismen', 'term' => $term->name, 'orderby' => 'menu_order', 'order' => 'asc')); ?>
Comments
Post a Comment