我继承了另一位开发人员的工作,这是一个由WP Bakery Page Builder创建的网站,我必须解决一些设计问题。
问题是,另一个开发人员添加了一些我在后端找不到的自定义CSS代码。
它在index.php中作为inlince CSS生成。看起来像这样。
<noscript><style type="text/css">body .wpex-vc-row-stretched, body .vc_row-o-full-height { visibility: visible; }</style></noscript><style type="text/css" data-type="vc_shortcodes-custom-css">.vc_custom_1530389595419{padding-top: 5% !important;padding-bottom: 5% !important;}</style>
这些 vc_custom _ * 类存在问题,我想删除所有这些类。
你们能帮我找到这些神秘的CSS吗?
非常感谢您。
答案 0 :(得分:0)
您可以使用 conditional tags定位要删除其样式的特定页面。您可以使用is_page()来定位页面页面(与另一种帖子类型相对),并传递页面ID,slug,title或no参数来定位任何页面。
function wpse_217881_remove_scripts() {
// Check for the page you want to target
if ( is_page( 'About Me And Joe' ) ) {
// Remove Styles
wp_dequeue_style( 'parent-style' );
wp_dequeue_style( 'child-style' );
wp_dequeue_style( 'parent-style-css' );
wp_deregister_style( 'parent-style' );
wp_deregister_style( 'child-style' );
wp_deregister_style( 'parent-style-css' );
}
}
我假设您已经存在,但为了明确起见,您应该调用从动作挂钩中出样式/注销样式的函数-在这种情况下为wp_enqueue_scripts。
尽管有名称,但它用于使脚本和样式同时入队
答案 1 :(得分:0)