删除 WordPress 中的一些 vc_custom CSS

问题描述 投票:0回答:4

我继承了另一位开发人员的作品,这是一个用 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吗?

非常感谢。

html css wordpress
4个回答
3
投票

我也遇到了完全相同的问题。但正如前面的答案所暗示的,这更多的是编码问题而不是代码问题。

我的解决方案是输入:

然后自动像

vc_custom_
这样的值 是边距、边框和内边距


0
投票

您可以使用条件标签来定位需要删除样式的特定页面。您可以使用 is_page() 来定位页面页面(而不是其他帖子类型)并传递页面 ID、slug、标题或不传递任何参数来定位任何页面。

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。

来自 wp_enqueue_scripts 文档:

尽管有这个名字,但它用于对脚本和样式进行排队


0
投票

其他答案对我没有帮助或不适用。

所以我找到了CSS隐藏在我的案例中的位置:打开相应的页面并在WP Bakery编辑器的右上角查找CSS齿轮按钮:


0
投票

天啊。我爱你,@philler82

您刚刚帮我解决了过去两个小时以来我一直试图解决的问题。

谢谢!

© www.soinside.com 2019 - 2024. All rights reserved.