【问题标题】:Remove or disabled one of the wordpress Widget Class删除或禁用其中一个 wordpress 小部件类
【发布时间】:2019-06-24 21:22:31
【问题描述】:

我在 Widget 类的布局上有一个小问题,我有 5 个相同的小部件,但其中一个小部件的视频剪辑有问题,

我查看了浏览器开发者模式并发现了问题 (请看截图上的红色高亮框)

<div id="shapely_home_parallax-20" class="widget shapely_home_parallax">        <section class=" border-bottom">

<div class="container">
<div class="row">
<div class="col-sm-10 col-sm-offset-1 text-center mt30">
<div class="">
<div class="mb32">
<div class="col-md-7 col-sm-6 text-center mb-xs-24">

<iframe>I remove all iframe for youtube</iframe></div>
<div class="col-md-4 col-md-offset-1 col-sm-5 col-sm-offset-1
text-left"></p>
<h3>User Friendly with Easy Installation</h3>
<p>We designed our range of adaptable flood barriers with our clients in mind. With a simple installation, almost anyone can secure their home or business against floods and water damage. Thanks to the customisable width and two variations of securing mechanisms, our flood barriers will ensure your investments remain safely sealed.
</p></div>
</div>                              </div>
</div>
<!--end of row-->

我试图找到一种方法来仅禁用此部分

<div class="col-sm-10 col-sm-offset-1 text-center mt30">

或者换成

<div class="text-center">

但没有任何效果

我只想修复一个小部件,但不是全部,我已经在 wordpress 中的其他 CSS 上尝试过它,但似乎它不起作用。

任何示例或类似问题都会很棒。

【问题讨论】:

  • 你只想删除类

标签: css wordpress widget wordpress-theming


【解决方案1】:

您可以使用 Jquery 删除这些类。

jQuery('#shapely_home_parallax-20 .mt30').removeClass("col-sm-10 col-sm-offset-1 mt30");

您只需拥有唯一的 div id 即可删除该类。

放置位置:

您可以在wp_footer() 函数之前将代码放在页脚文件中。如果没有标签,那么你应该把标签放在里面。

【讨论】:

    【解决方案2】:

    @瓦西姆

    非常感谢

    它工作正常,但我没有放入页脚文件,因为由于更新主题等原因,我不喜欢在 PHP 文件中添加任何内容。

    我已经把它放在WordPress sn-p中的代码上

    <?php
    function script_widget_CSS_remove(){ ?>
    
    <script>
    jQuery('#shapely_home_parallax-20 .mt30').removeClass("col-sm-10 col-sm-offset-1 mt30");
    </script>
    
    <?php } 
    
    add_action('wp_footer', 'script_widget_CSS_remove');
    

    它工作正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-12
      • 2018-08-30
      • 2016-12-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多