删除或禁用其中一个wordpress Widget类

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

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

我查看了浏览器开发者模式并发现了问题(请参见截图上的红色突出显示框)

enter image description here

<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
2个回答
1
投票

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

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

你只有一个唯一的div id,你可以删除那些类。

放在哪里:

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


0
投票

@Vasim

非常感谢

它工作正常,但我没有放入页脚文件,因为我不喜欢因为更新主题等而在PHP文件上放任何东西。

我把它放在WordPress片段中的代码上

<?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');

它工作正常

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