Вы находитесь на странице: 1из 1

Using Custom Post Types A Page displaying the posts belonging to a custom post type.

In this case, the custom post type is book. The Template below is designed to work with the WordPress Twenty Eleven theme but is best used as a Twenty Ten Child Theme.
<?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 orginal 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(); ?>

Вам также может понравиться