Php Wordpress-是页面模板吗

Php Wordpress-是页面模板吗,php,wordpress,responsiveness,Php,Wordpress,Responsiveness,我一直在使用以下代码设置wordpress站点中某些页面的列宽: if ( is_page_template( 'fullwidthhome.php' ) ) { global $content_width; $content_width = 1080; /* pixels */ } elseif ( is_page_template( 'wideContent.php' ) ) { global $content_width; $content_widt

我一直在使用以下代码设置wordpress站点中某些页面的列宽:

if ( is_page_template( 'fullwidthhome.php' ) ) {
    global $content_width;
    $content_width = 1080; /* pixels */
  }
  elseif ( is_page_template( 'wideContent.php' ) ) {
    global $content_width;
    $content_width = 1080; /* pixels */
  }
这在带有自定义模板的页面上非常有效,但我不太确定如何使其适用于自定义帖子类型

当我将模板设置为自定义帖子类型时,它似乎不起作用:

  elseif ( is_page_template( 'single-widecontent.php' ) ) {
    global $content_width;
    $content_width = 1080; /* pixels */
  }
有什么想法吗

蒂亚


斯蒂芬

这个函数如何获取帖子类型

很简单。应该是这样的

else if ( 'widecontent' == get_post_type() ) {

global $content_width;
$content_width = 1080; /* pixels */

}
事实上,我最后选择的是单数“wideContent”:

谢谢大家