无法确定要使用哪个条件标记将页面标题添加到使用自定义帖子类型的公文包存档页面。
这不起作用:
if( is_archive(\'portfolio\') )
echo \'<div class="portfolio-title">Add Your Page Title Here</div>\';
};
//下面是生成公文包帖子类型和归档的代码
add_action( \'init\', \'executive_portfolio_post_type\' );
function executive_portfolio_post_type() {
register_post_type( \'portfolio\',
array(
\'labels\' => array(
\'name\' => __( \'Portfolio\', \'executive\' ),
\'singular_name\' => __( \'Portfolio\', \'executive\' ),
),
\'exclude_from_search\' => true,
\'has_archive\' => true,
\'hierarchical\' => true,
\'menu_icon\' => get_stylesheet_directory_uri() . \'/images/icons /portfolio.png\',
\'public\' => true,
\'rewrite\' => array( \'slug\' => \'portfolio\' ),
\'supports\' => array( \'title\', \'editor\', \'author\', \'thumbnail\', \'excerpt\', \'trackbacks\', \'custom-fields\', \'comments\', \'revisions\', \'page-attributes\', \'genesis-seo\' ),
)
);
}
//或者,它可能需要添加到公文包归档模板中
function executive_portfolio_grid() {
if ( has_post_thumbnail() ){
echo \'<div class="portfolio-featured-image">\';
echo \'<a href="\' . get_permalink() .\'" title="\' . the_title_attribute( \'echo=0\' ) . \'">\';
echo get_the_post_thumbnail($thumbnail->ID, \'portfolio\' );
echo \'</a>\';
echo \'</div>\';
}
}