admin管理员组文章数量:1130349
Trying to load CSS file conditionally – only for specific pages with the following:
add_filter('tablepress_use_default_css', 'tablepress_css_conditional_load');
function tablepress_css_conditional_load($load) {
return ((!is_page(array( 229, 9 ))) ? false : $load);
}
For some reason it is not working. To make sure that there is no mistake in the IDs I replaced ! is_page( array( 229, 9 ) ) with ! is_page() and with ! is_single() but still it is not working. Deactivated other plugins, changed theme, still nothing. The CSS name is verified with the plugin author. When the above part is replaced with is_single() the code works in a way that lets the CSS load for any page – not for posts. However the point is to load only for the named pages. Which is the correction needed?
Trying to load CSS file conditionally – only for specific pages with the following:
add_filter('tablepress_use_default_css', 'tablepress_css_conditional_load');
function tablepress_css_conditional_load($load) {
return ((!is_page(array( 229, 9 ))) ? false : $load);
}
For some reason it is not working. To make sure that there is no mistake in the IDs I replaced ! is_page( array( 229, 9 ) ) with ! is_page() and with ! is_single() but still it is not working. Deactivated other plugins, changed theme, still nothing. The CSS name is verified with the plugin author. When the above part is replaced with is_single() the code works in a way that lets the CSS load for any page – not for posts. However the point is to load only for the named pages. Which is the correction needed?
本文标签: functionsLoad CSS file conditionally
版权声明:本文标题:functions - Load CSS file conditionally 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749022073a2304532.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论