个性化阅读
专注于IT技术分析

删除或禁用wordpress窗口小部件类之一

我在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上尝试过, 但似乎无法正常工作。

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


#1


你可以使用Jquery删除那些类。

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

你只有引用的唯一div ID, 可以删除该类。

放置位置:

你可以将代码放在wp_footer()函数之前的页脚文件中。如果没有标签, 则应放在标签内。


#2


瓦西姆

非常感谢

它工作正常, 但是我没有放入页脚文件, 因为由于更新主题等原因, 我不喜欢在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');

它工作正常

赞(0)
未经允许不得转载:srcmini » 删除或禁用wordpress窗口小部件类之一

评论 抢沙发

评论前必须登录!