I’m unable to get this wordpress loop to work: I’m trying to get it to display two post types, the slugs are ‘movie’ and ‘tvshow’.
Not sure what I’m doing wrong here – It’s displaying whichever post type I put first after the =>, and they both work by themselves.
<?php
$movieArg = array('post_type' => 'movie', 'tvshow');
$query = new WP_Query($movieArg);
while($query -> have_posts()) : $query -> the_post();
?>
<div class="movie">
<h2><?php the_title(); ?> </h2>
</div>
<?php endwhile; ?>
There’s an issue with the way you’re specifying multiple post types.
They need to be listed inside an array. Right now you’re setting the post type to
movie
whiletvshow
is another element in the main array.Change this:
To: