感谢@bjornredemption,我使用了以下代码片段:
$args = array(\'category\' => $wp_query->get_queried_object_id(), \'posts_per_page\' => -1, \'orderby\'=> \'title\', \'order\' => \'ASC\', \'post_type\' => array( \'post\', \'attachment\'),\'post_status\' => array( \'publish\', \'inherit\'));
$glossaryposts = get_posts( $args );
此外,必须更改函数have\\u posts(),因为默认函数不检查附件。