Hey,
I am running WordPress with custom taxonomy, added through functions.php in my theme. I am calling posts of a certain post type in another template in my theme but want to restrict which ones it shows by only showing those posts if their taxonomy value equals the current post name that is calling it.
So for example: if I'm on the "Red Tree" album page and I'm calling all posts under the "songs" post type, it would call every song. I have custom taxonomy labeled as "disc" and I want to restrict to only show posts with "Red Tree" select as their taxonomy value if you are on the red tree page.
So I just need to say: if the post's "disc" taxonomy value is the same as the current page name, then continue, if not, don't display anything.
This is how I am calling posts of the "song" post type:
<?php
$pages = get_posts('numberposts=9999&post_type=song&post_status=publish&order=ASC&orderby=date');
$i = 1;
foreach( $pages as $page ) {
$content = $page->post_title;
if( empty($content) ) continue;
$content = apply_filters('the_content', $content);
if ($i%2===0) { ?><tr class="gigpress-row gigpress-alt">
<?php } else { ?><tr class="gigpress-row"><?php } ?>
<td><?php echo $page->post_title ?></td>
<td><?php echo get_post_meta($page->ID, "p30-length", true); ?></td>
<td><a href="http://itunes.com/<?php echo get_post_meta($page->ID, "p30-itunes-song", true); ?>">BUY</a></td>
</tr>
<?php $i++;
} ?>
Thanks, Wade