Multiple thumbnails in WordPress based on page template?
Is there a way to a开发者_Go百科dd multiple thumbnails in a page based on page template or page ID instead of post type (post, page)?
You can add a conditional statement to test for a specific page id:
if(is_page('<your page id>')){
// Do your thing
}
Similarly, you can test for a specific page template like so:
if(is_page_template('<page template file name>']){
// Go on wit' you bad self
}
Make sure that when you use is_page_template()
that you feed it the file name of the template, e.g., is_page_template('two-columns.php')
, as opposed to the name of the template, e.g., is_page_template('Two Columns')
.
精彩评论