0

I have been using the following code to set the column width on certain pages within a wordpress site:

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 */
  }

This works great on pages with custom templates, but I not quite sure how to get it to work for custom post types.

It doesn't seem to work when I set the the template to that of my custom post type:

  elseif ( is_page_template( 'single-widecontent.php' ) ) {
    global $content_width;
    $content_width = 1080; /* pixels */
  }

Any thoughts?

TIA!

Steph

4

3 回答 3

0

这个功能怎么样get_post_type() http://codex.wordpress.org/Function_Reference/get_post_type

于 2015-03-16T18:23:33.713 回答
0

我最后真的去了is_singular ('wideContent'):)

多谢你们!!

于 2015-03-16T18:36:22.570 回答
0

这很简单。应该如下。

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

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

}
于 2015-03-16T18:31:38.067 回答