我使用的是一个模板,它使用自定义的Post类型“movies”。当我尝试更改页面时,发现404未找到:(
这是我的索引。php
<div id="content">
<?php
$temp = $wp_query;
$page = get_query_var(\'page\');
$page = (!empty($page) ? $page : 1);
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query(\'post_type=movies\'.\'&posts_per_page=6&paged=$page\');
?>
<?php while (have_posts()) : the_post(); ?>
<div class="box " id="post-<?php the_ID(); ?>">
<div class="boxentry">
<div class="btitle">
<h2 align="center"><a href="<?php the_permalink() ?>" rel="bookmark" title="Ver <?php the_title(); ?>"><?php echo get_post_meta($post->ID, \'wtf_ryear\', true); ?></a></h2>
</div>
<!--div class="clear"></div-->
</div>
<div class="boxim">
<?php
if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink() ?>"><img class="boximg" src="<?php bloginfo(\'stylesheet_directory\'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=270&w=180&zc=1" alt=""/></a>
<?php } else { ?>
<a href="<?php the_permalink() ?>"><img class="boximg" src="<?php bloginfo(\'template_directory\'); ?>/images/dummy.png" alt="" /></a>
<?php } ?>
</div>
</div>
<?php if(++$counter % 4 == 0) : ?>
<div class="clear"></div>
<?php endif; ?>
<?php endwhile; ?>
<div class="clear"></div>
<?php getpagenavi(); ?>
<?php $wp_query = null; $wp_query = $temp;?>
</div>
这是我的帖子类型:
function post_type_movies() {
register_post_type(
\'movies\',
array( \'public\' => true,
\'publicly_queryable\' => true,
\'has_archive\' => true,
\'hierarchical\' => false,
\'menu_icon\' => get_stylesheet_directory_uri() . \'/images/movie.png\',
\'labels\'=>array(
\'name\' => _x(\'Movies\', \'post type general name\'),
\'singular_name\' => _x(\'Movie\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'Movies\'),
\'add_new_item\' => __(\'Add New Movie\'),
\'edit_item\' => __(\'Edit Movie\'),
\'new_item\' => __(\'New Movie\'),
\'view_item\' => __(\'View Movie\'),
\'search_items\' => __(\'Search Movies\'),
\'not_found\' => __(\'No Movies found\'),
\'not_found_in_trash\' => __(\'No Movie found in Trash\'),
\'parent_item_colon\' => \'\'
),
\'show_ui\' => true,
\'menu_position\'=>5,
\'query_var\' => true,
\'rewrite\' => TRUE,
\'rewrite\' => array( \'slug\' => \'pelicula\', \'with_front\' => FALSE,),
\'register_meta_box_cb\' => \'mytheme_add_box\',
\'supports\' => array(
\'title\',
\'thumbnail\',
\'comments\',
\'editor\'
)
)
);
}
add_action(\'init\', \'post_type_movies\');
点击查看
http://ddlpremium.com/peliculeros提前谢谢。