I’m developing a template to display videos in a tiled sort of fashion. The loop I’ve created is meant to grab all posts with the category of “video”. I’ve also tried this with format-type of video, and a template based on taxonomy-post-format-post-video.php, but with the same results:
Basically, the loop works fine in certain browsers (Safari 8) but actually fails to get any posts from the query in other browsers. (mainly mobile browsers, and IE).
When the loop is working, I get an expected single video. When it is not, I get the error “Sorry, no videos found….” – Same code, different browsers, different results.
Here is a link to an example of this behavior: http://www.enableart.org/langschwartzwald/wordpress/blog/category/video/
and here is the code:
<?php
$the_query = new WP_Query('category_name=video'); ?>
if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="video_tile">
<?php the_content();
the_id(); ?>
<div class="video_title">
<?php the_title(); ?>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<br>
<h1 style="color: lightblue;"><?php _e( 'Sorry, no videos found...' ); ?></h1>
<?php endif; ?>
There is something wrong with Your markup, it should be:
basically
<!-- the loop -->
comment type is not allowed in php and it messes things up (I guess)