admin管理员组文章数量:1026989
Please help with this code for custom post type "video":
If is single-video.php page {
list custom-taxonomy of video. Example actors
} Else { do nothing }
I´m tried with is_single, is_singular, is_page_template but imposible.
Please help with this code for custom post type "video":
If is single-video.php page {
list custom-taxonomy of video. Example actors
} Else { do nothing }
I´m tried with is_single, is_singular, is_page_template but imposible.
Share Improve this question edited Jan 31, 2012 at 20:54 Chip Bennett 55.1k8 gold badges91 silver badges170 bronze badges asked Oct 5, 2011 at 15:40 FontepinkFontepink 1611 gold badge1 silver badge6 bronze badges1 Answer
Reset to default 31According to the WordPress conditional docs it should be:
if ( is_singular( 'video' ) ) {
// do conditional stuff
} else {
//do other stuff
}
Also if you want a blank page or no content to show when the CPT is not video you don't really need the else
so you could omit it. You could ALSO do something like:
if ( ! is_singular( 'video' ) ) {
// do nothing
} else {
//do conditional stuff
}
Please help with this code for custom post type "video":
If is single-video.php page {
list custom-taxonomy of video. Example actors
} Else { do nothing }
I´m tried with is_single, is_singular, is_page_template but imposible.
Please help with this code for custom post type "video":
If is single-video.php page {
list custom-taxonomy of video. Example actors
} Else { do nothing }
I´m tried with is_single, is_singular, is_page_template but imposible.
Share Improve this question edited Jan 31, 2012 at 20:54 Chip Bennett 55.1k8 gold badges91 silver badges170 bronze badges asked Oct 5, 2011 at 15:40 FontepinkFontepink 1611 gold badge1 silver badge6 bronze badges1 Answer
Reset to default 31According to the WordPress conditional docs it should be:
if ( is_singular( 'video' ) ) {
// do conditional stuff
} else {
//do other stuff
}
Also if you want a blank page or no content to show when the CPT is not video you don't really need the else
so you could omit it. You could ALSO do something like:
if ( ! is_singular( 'video' ) ) {
// do nothing
} else {
//do conditional stuff
}
本文标签: Conditional for singleposttypephp
版权声明:本文标题:Conditional for single-{post-type}.php 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745670043a2162403.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论