WP排除多个页面模板

我需要从某些页面模板中排除子主题功能。

我可以排除一个这样的模板

if (!(is_page_template( 'templates/my_page_template.php' )))
{ // the child theme function here
 ....
}

如何添加更多页面模板以排除语句?


#1


if (
    !(
    (is_page_template( 'templates/my_page_template.php' ))   or 
    (is_page_template( 'templates/my_page_template1.php' ))   or 
    (is_page_template( 'templates/my_page_template2.php' ))   or 
    (is_page_template( 'templates/my_page_template3.php' ))   or 
    )

)
{ // the child theme function here
 ....
}

#2


is_page_template函数接受一个数组作为参数。参见此处:https://developer.wordpress.org/reference/functions/is_page_template/

你可以执行以下操作:

if ( ! ( is_page_template( array('templates/my_page_template.php', 'templates/my_page_template2.php') ) ) )
{ // the child theme function here
  ....
}

来源:

https://www.srcmini02.com/65068.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37350.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?