2017-08-06 49 views
-1

我正在开发一个wp主题,并且我已经创建了一个自定义样式css或插件social count plus 。 这个类运行良好,但有一个问题,该插件加载一个自己的CSS,这会错误我的风格,特别是有文件“counter.css”(我无法阻止加载因为也有其他风格用户可以选择),该文件包含类是这样的:如何禁用小部件css类?

.social-count-plus a { 
-moz-transition: all .4s ease; 
-o-transition: all .4s ease; 
-webkit-transition: all .4s ease; 
transition: all .4s ease; 
display: block; 
margin: 0 auto; 
opacity: 1; 
padding: 0 !important; 
} 

我需要在不修改,以彻底清除此类插件,是一个办法做到这一点的?

回答

0

你可以尝试使用这个插件来改变CSS样式表的加载顺序。 https://wordpress.org/plugins/re-order-css-and-js-loading-order/

或者您可以为您的样式表设置优先级,以确保它在另一个之后加载。 https://wordpress.stackexchange.com/questions/218610/give-priority-to-child-theme-stylesheet

add_action('wp_enqueue_scripts', 'fruitful_load_child_stylesheets', 20); 

然后确保您的自定义样式表,你可以使用重要的你的风格标签覆盖以前的风格样式等之后被加载之后。

.social { 
    color: red!important; 
} 

您还可以使用继承将样式设置为默认值。

.social { 
    display: inherit; 
} 
0

在主题functions.php文件中添加以下代码:

function wp1232_remove_class() { 
    ?> 
     <script> 
      jQuery(document).ready(function(){ 
       jQuery(".widget .social-count-plus").removeClass("social-count-plus"); 
      }); 
     </script> 
    <?php 
} 
add_action('wp_head', 'wp1232_remove_class'); 
+0

这也将删除我的CSS –

+0

您可以在此添加自己的类:'的jQuery(”窗口小部件。社会,count-再加上 “)removeClass(” 社会计数加“)addClass( '我的社交-数加');' –