我正在试图修改我的作者。php页面,以便它包含作者添加的自定义帖子类型。
下面是我拥有的内容,它首先显示普通帖子,然后显示自定义帖子类型(my\\u custom\\u post\\u type)。
第一部分似乎工作正常,显示正确。然而,第二部分似乎显示了所有自定义的帖子类型,而不仅仅是那些与作者的作者相关的帖子类型。php页面。
任何帮助都将不胜感激。非常感谢。
<!-- Show normal posts from the author -->
<?php if ( have_posts() ): ?>
<h3>Posts by <?php echo $curauth->first_name; ?>:</h3>
<?php while ( have_posts() ) : the_post(); ?>
<p><?php the_title(); ?></p>
<?php endwhile; ?>
<?php else: ?>
<p><?php _e(\'User has no posts\'); ?></p>
<?php endif; ?>
<!-- Show custom post type posts from the author -->
<?php global $wp_query;
query_posts( array(
\'post_type\' => \'my_custom_post_type\' ,
\'author=\' . $authorid,
\'showposts\' => 10 )
); ?>
<?php if ( have_posts() ): ?>
<h3>Custom post entries by <?php echo $curauth->first_name; ?>:</h3>
<?php while ( have_posts() ) : the_post(); ?>
<p><?php the_title(); ?></p>
<?php endwhile; ?>
<?php else: ?>
<p><?php _e(\'User has no custom posts\'); ?></p>
<?php endif; ?>