Custom posts type with custom taxonomy
-
I having some difficulty figuring out how to query a custom post type in a specific (custom) taxonomy.
So far I have the following code:
<?php query_posts( array('post_type' => array('post','tvshows'), 'showposts' => $nitem, 'orderby' => 'date' )); ?> <?php while ( have_posts() ) : the_post(); ?> <?php if (has_post_thumbnail()) { $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'medium'); $imgsrc = $imgsrc[0]; } elseif ($postimages = get_children("post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=0")) { foreach($postimages as $postimage) { $imgsrc = wp_get_attachment_image_src($postimage->ID, 'medium'); $imgsrc = $imgsrc[0]; } } elseif (preg_match('/<img [^>]*src=["|\']([^"|\']+)/i', get_the_content(), $match) != FALSE) { $imgsrc = $match[1]; } else { $img = get_post_custom_values('poster_url'); $imgsrc = $img[0]; } ?>
I have tax for “cast”. For example use the name: alexandro. How to filter post by my taxonomy? I’ve tried, but fail. ??
- The topic ‘Custom posts type with custom taxonomy’ is closed to new replies.