请帮助使用此代码,用于自定义post类型的“视频”:
If is single-video.php page {
list custom-taxonomy of video. Example actors
} Else { do nothing }我试过了is_single,is_singular,is_page_template,但是不可能。
发布于 2011-10-05 16:12:49
根据WordPress条件文档,应该是:
if ( is_singular( 'video' ) ) {
// do conditional stuff
} else {
//do other stuff
}另外,如果您希望在CPT不是视频时显示一个空白页或没有内容,那么您实际上并不需要else,所以可以省略它。你也可以这样做:
if ( ! is_singular( 'video' ) ) {
// do nothing
} else {
//do conditional stuff
}https://wordpress.stackexchange.com/questions/30341
复制相似问题