可以
自定义帖子类型指向哪里?是单身吗。php或页面。php我有一个页面。php的模板部分显示了我的每个自定义类型,但当我单击该项目本身时,我只得到404\'d
这是我的注册自定义帖子类型
$labels = array(
\'name\' => _x( \'podiums\', \'Post Type General Name\', \'text_domain\' ),
\'singular_name\' => _x( \'podium\', \'Post Type Singular Name\', \'text_domain\' ),
\'menu_name\' => __( \'Post Type\', \'text_domain\' ),
\'parent_item_colon\' => __( \'Parent Item:\', \'text_domain\' ),
\'all_items\' => __( \'All Items\', \'text_domain\' ),
\'view_item\' => __( \'View Item\', \'text_domain\' ),
\'add_new_item\' => __( \'Add New Item\', \'text_domain\' ),
\'add_new\' => __( \'Add New\', \'text_domain\' ),
\'edit_item\' => __( \'Edit Item\', \'text_domain\' ),
\'update_item\' => __( \'Update Item\', \'text_domain\' ),
\'search_items\' => __( \'Search Item\', \'text_domain\' ),
\'not_found\' => __( \'Not found\', \'text_domain\' ),
\'not_found_in_trash\' => __( \'Not found in Trash\', \'text_domain\' ),
);
$args = array(
\'label\' => __( \'Podium\', \'text_domain\' ),
\'description\' => __( \'Podium Photos Taken at Nottingham Go Karts\', \'text_domain\' ),
\'labels\' => $labels,
\'supports\' => array( \'title\', \'thumbnail\', \'custom-fields\', ),
\'hierarchical\' => false,
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'show_in_nav_menus\' => true,
\'show_in_admin_bar\' => true,
\'menu_position\' => 5,
\'can_export\' => false,
\'has_archive\' => true,
\'exclude_from_search\' => false,
\'publicly_queryable\' => true,
\'capability_type\' => \'page\',
);
register_post_type( \'group\', $args );
我的页面。php
<?php get_header(); ?>
<main class="container">
<div class="row">
<section id="post-<?php the_ID(); ?>" <?php post_class(\'podium col-md-12\'); ?>>
<?php query_posts( \'post_type=group&posts_per_page=5\'); ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post();
get_template_part( \'content\', \'podium\' );
// End the loop.
endwhile;
?>
</section><!-- Article End -->
</div><!-- Row End -->
</main><!-- Section End -->
这是我的内容讲台。php
<h1><?php the_title(); ?></h1>
<p>
View all past groups thats visited Nottingham Go Karts
</p>
<ul>
<li class="col-xs-6 col-sm-6 col-md-4 col-lg-3">
<a href="<?php the_permalink() ?>">
<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, \'post-thumbnail\') ); ?>
<img src="<?php echo $url ?>" />
</a>
</li>
</ul>
应该是我的页面。php实际上是在显示项目本身,而内容讲台实际上是在单独显示它们?
我在google上到处搜索,我只是越来越困惑,似乎什么都没用。要看到它的作用,就在这里http://thomasrenshaw.com/gallery/