Title: Custom Types / The Loop
Last modified: August 19, 2016

---

# Custom Types / The Loop

 *  [ekrocker](https://wordpress.org/support/users/ekrocker/)
 * (@ekrocker)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-types-the-loop/)
 * If someone could point me in the right direction… it would greatly be appreciated.
 * I understand how to add custom content types but how do I get them to show up
   in the loop? I’d almost like a Tumblr like look… if it’s just a link then when
   you click on the title… it’s just the link. Is there a way to modify the loop
   for content types?

Viewing 1 replies (of 1 total)

 *  [Agus Suhanto](https://wordpress.org/support/users/suhanto/)
 * (@suhanto)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-types-the-loop/#post-1584430)
 * You have to construct your own WP_Query() object, assign it to the global $wp_query
   variable and then do the loop.
 *     ```
       global $post, $paged, $wp_query;
   
       $args = array(
          'post_type' => $post_type,
          'post_status' => 'publish',
          'paged' => $paged,
          'posts_per_page' => 5, //TODO: options
          'caller_get_posts' => 1
       );
   
       $temp_post = $post; // assign original post to temp variable
       $temp_query = $wp_query;  // assign orginal query to temp variable
       $wp_query = new WP_Query($args);
   
       while ( have_posts() ) {
          the_post();
   
          // Here you can echo any post attributes, for example:
          the_title();
       }
   
       // And don't forget to restore everything to its original values
       $wp_query = $temp_query;
       $post = $temp_post;
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Custom Types / The Loop’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Agus Suhanto](https://wordpress.org/support/users/suhanto/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/custom-types-the-loop/#post-1584430)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
