如何在显示默认帖子的同时显示自定义帖子wordpress


How to display custom post wordpress while showing default posts?

我正在尝试显示新的自定义帖子和默认帖子。如何显示两个帖子(默认,my_custom_post)

<div id="primary" class="site-content">
<div id="content" role="main">
<?php wp_list_pages('title_li=');
wp_nav_menu();?>
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php twentytwelve_content_nav( 'nav-below' ); 
?><?php else : ?>
<?php wp_reset_query();
query_posts('post_type=my_custom_post'); // my custom post
?>

但目前只显示了一篇帖子。

这就是在wordpress中显示自定义帖子的方式。

<?php
    $type = 'my_custom_post';
    $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().
    ?>