How to display custom post wordpress while showing default posts?

I am trying to display new custom post and the default post as well.
How to display both posts(default,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
?>

but only single post is displaying yet.

Related posts

Leave a Reply

1 comment

  1. This is how you display custom posts in 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().
        ?>