Why is there an infinite loop in my CPT?
-
I built a CPT for “movies” and I created a custom page for the CPT as well. Somehow the CPT is not working as I want as the only thing it does is an infinite loop and it gives me no errors; i decided to go into the source code and I still get not error(after waiting at least 3mins before it actually stop loading).
So that’s it, can somebody tell me if there’s an error on this?:
<?php /* Template Name: movie Template Post Type: page */ ?> <?php get_header(); ?> <div class="col-md-12 anime-posts"> <?php $movies = new WP_Query(array( 'post_type' => 'movies', )); ?> <?php if($movies->have_posts()) : while($movies->have_posts()) : the_post(); ?> <div class="item col-md-3"> <div class="img"> <a href="<?php echo the_permalink(); ?>" class="thumbnail"><?php echo the_post_thumbnail(); ?></a> <div class="badge"><?php echo the_category(','); ?></div> </div> <div class="bottom-info"> <h6><?php echo the_title(); ?></h6> </div> </div> <?php endwhile; ?> <?php else : ?> <div class="alert alert-danger col-md-12" style="margin-right: 15px; margin-left: 15px;">There's not a single movie yet. Sorry for the inconvenience.</div> <?php endif; ?> </div> <?php get_footer();?>
I really have not idea why is not showing me anything(apart from the infinite loop) in the front end.
This is how I registered the CPT in the functions.php file:
register_post_type( 'movies', $movie_args );
with $movie_arg being just custom configurations when I made it… if you need to see the whole thing(cpt function), just tell me.
Thanks in advance.
- The topic ‘Why is there an infinite loop in my CPT?’ is closed to new replies.