0
<?php
/**
 * Template Name: Movies
 */
?>

<?php get_header(); ?>

        <div id="container">
            <div id="content">

<?php
$type = 'movies';
$args=array(
  'post_type' => $type,
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
  while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
    <?php
  endwhile;
}
wp_reset_query();  // Restore global post data stomped by the_post().
?>
            </div><!-- #content -->
        </div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
  • What do you mean by not displaying anything. Are there no posts displayed, is whole page not displaying? Please update your question – Pieter Goosen Apr 4 '14 at 9:51
  • In the future, please try to improve the quality of your questions, by including a description of basic debugging efforts. Simply setting WP_DEBUG to true would have identified the root cause in this case. – Chip Bennett Apr 4 '14 at 12:50
2
Please try with `ignore_sticky_posts` instead of `caller_get_posts` which is deprecated.
  • Hi........ i tried your code and it is working fine ....... make sure you have selected the correct template from "page attributes" as well as the post_type name is correct. – Anoop D Apr 4 '14 at 9:54
  • 3
    caller_get_posts is as dead as the dinosaurs. Funny to see how many developers still use this. Don't developers set debug to true anymore, as this would have been picked up by just this simple setting – Pieter Goosen Apr 4 '14 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.