Title: Custom posts loading problem
Last modified: August 30, 2016

---

# Custom posts loading problem

 *  [Mustafa 007](https://wordpress.org/support/users/mustafa-007/)
 * (@mustafa-007)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/custom-posts-loading-problem/)
 * Hi
    I am new to WordPress, I have developed a theme from scratch. I have created
   a custom post type “portfolio” and I want to load the added post into my page
   using below codes.
 *     ```
       <?php
           $args = array('post_type'=>'Portfolio');
           $query = new WP_Query($args);
   
           if($query->have_posts()) : while($query->have_posts()) : $query->the_post();?>
   
               <h1><?php the_title(); ?></h1>
               <p> <?php the_content()?></p>
   
           <?php endwhile; endif; wp_reset_postdata(); ?>
       ```
   
 * But just the first post is loaded. I think the loop dose not work. what do you
   think? what is the problem?
    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [10 years, 10 months ago](https://wordpress.org/support/topic/custom-posts-loading-problem/#post-6369362)
 * I’m not sure if you’ve taken a look at the template hierarchy page or but it 
   is a good source of information for theme development. It can be found: [https://developer.wordpress.org/themes/basics/template-hierarchy/](https://developer.wordpress.org/themes/basics/template-hierarchy/)
 * Or are you trying to load the content in a particular page template?
 *  Thread Starter [Mustafa 007](https://wordpress.org/support/users/mustafa-007/)
 * (@mustafa-007)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/custom-posts-loading-problem/#post-6369406)
 * Yes, I want to load them in a partucular page of my template, for example I need
   to load the portfolio posts to portfolio page.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom posts loading problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Mustafa 007](https://wordpress.org/support/users/mustafa-007/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/custom-posts-loading-problem/#post-6369406)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
