I have the following loop, and I am trying to filter this based on a couple values, so that the loop can be more specific to each selection.
<div class="film-list">
<?php $loop = new WP_Query( array( 'post_type' => 'drama', 'posts_per_page' => -1, 'category' => 'current' ) ); ?><?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php
$post_id = get_the_id();
$data['episode'] = get_post_meta($post_id, "episode",true);
$data['released'] = get_post_meta($post_id, "released",true);
$data['type'] = get_post_meta($post_id, "type",true);
$data['series'] = strip_tags( get_the_term_list( $wp_query->post->ID, 'drama_category', '', ', ', '' ) );
?>
<div class="item">
<div class="inner">
<a class="poster" href="<?php the_permalink(); ?>"><img alt="<?php print $data['series']; print $data['type']; ?>" src="<?php print $feat_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); ?>">
<div class="status">
<div class="dub">
<?php print $data['type']; ?>
</div><span class="bar"></span>
<div class="ep">
<?php print $data['episode']; ?>
</div>
</div></a>
<a class="name" data-jtitle="<?php print $data['series']; print $data['type']; ?>" href="<?php the_permalink(); ?>">
<?php print $data['series']; print ' ('; print $data['type']; print ')'; ?>
</a>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>
The above code is a displaying the results within the custom post_type
of drama and working flawlessly, however I am wondering how I can make my loop filter for only post which contain data of a specific lettering inside the $data['type']
portion.
For example
if (strpos($data['type'], 'dub') !== false) {
// run our loop as normal displaying 20 - 30 results
// (whatever our limitation on post_per_page is, this doesn't work but it gives you a better idea of what I want
}