情况我有两个cpt:
这两个CPT I中的项目和作品具有相同的分类“类别”,术语也相同:
建筑、景观、室内设计我有如下网址
projects/architecture
works/architecture
so on...
问题现在的问题是,上面的两个URL返回相同的内容,即术语体系结构的所有存档,无论cpt如何。有没有办法projects/architecture
将只返回以下所有邮件projects 用于期限的architecture?
注意,我正在使用Custom Post Type Permalinks 使用permalink格式/cpt/term/post_title
编辑这里是我的category template (category.php)
<?php get_header(); ?>
<!-- info about the category -->
<?php
/* Queue the first post, that way we know
* what date we\'re dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
if ( have_posts() )
the_post();
?>
<h1 class="page-title"><?php
_e( ucwords($post->post_type), \'boilerplate\' );
?></h1>
<?php
/* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
/* Run the loop for the archives page to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-archives.php and that will be used instead.
*/
?>
<ul class=\'large-block-grid-4 small-block-grid-3 listWrap\'>
<?php
get_template_part( \'loop\', \'category\' );
?>
</ul>
<?php
?>
<?php get_footer(); ?>
这是我的category loop (循环类别.php)<?php while ( have_posts() ) : the_post(); ?>
<?php
$attachments = get_posts( array(
\'post_type\' => \'attachment\',
\'post_parent\' => $post->ID,
\'orderby\' => \'menu_order\',
\'order\' => \'ASC\',
\'numberposts\' => 1
) );
?>
<?php $img = wp_get_attachment_image_src($attachments[0]->ID, \'full\');?>
<li class=\'listwp equalize\'>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class=\'th\'>
<img src=\'<?php echo $img[0]; ?>\'>
<?php $categories = get_the_terms($post->ID, \'category\'); ?>
<div>
<span>
<?php foreach($categories as $category): ?>
<?php echo $category->name; ?>
<?php endforeach; ?>
</span>
</div>
</a>
<h2><?php the_title(); ?></h2>
</li>
<?php endwhile; ?>