Title: Create a page for custom posts
Last modified: August 20, 2016

---

# Create a page for custom posts

 *  [Mark Shirley](https://wordpress.org/support/users/ravalde/)
 * (@ravalde)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/create-a-page-for-custom-posts/)
 * I am trying to create a page to display my custom posts types. They have a custom
   template and custom fields that work fine. I have tried the code from the codex
   below but I just get a blank page.
 *     ```
       <?php
       /**
        * Template Name: Page of Books
        *
        * Selectable from a dropdown menu on the edit page screen.
        */
       ?>
   
       <?php get_header(); ?>
       		<div id="container">
       			<div id="content">
       <?php
       $type = 'book';
       $args=array(
        'post_type' => $type,
        'post_status' => 'publish',
        'paged' => $paged,
        'posts_per_page' => 2,
        'ignore_sticky_posts'=> 1
       );
       $temp = $wp_query; // assign ordinal query to temp variable for later use
       $wp_query = null;
       $wp_query = new WP_Query($args);
       ?>
       <?php get_template_part( 'loop', 'index' );?>
       	</div><!-- #content -->
       </div><!-- #container -->
       <?php get_sidebar(); ?>
       <?php get_footer(); ?>
       ```
   

The topic ‘Create a page for custom posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Mark Shirley](https://wordpress.org/support/users/ravalde/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/create-a-page-for-custom-posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
