0
我正在构建一个网站,其中包含一个wordpress博客,并且在我定制一个主题的过程中遇到了轻微的障碍。如何使用php删除wordpress中的内联样式
我在页脚中使用了几个小部件来显示最近的帖子等,但他们显示自己的内联样式。我无法找到任何可能添加样式的地方,但我在functions.php文件中找到了添加相关元素的id和class的函数,我想知道是否可以将一些php添加到函数中为了去除下面的造型:
代码如下:
function twentythirteen_widgets_init() {
register_sidebar(array(
'name' => __('Main Widget Area', 'twentythirteen'),
'id' => 'sidebar-1',
'description' => __('Appears in the footer section of the site.', 'twentythirteen'),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
对页的代码是这样的:
<aside id="recent-posts-2" class="widget widget_recent_entries masonry-brick" style="position: absolute; top: 0px; left: 0px;">
,所以我要离开id和类,但只是去掉“风格”元素
我知道PHP可能不是最好的方式做到这一点,所以我打开的建议,但如果我可以弹出一个preg替换或注册ex等等功能,将是伟大的。
干杯家伙
尽管在个案的基础上,您可以在CSS中使用'!important'覆盖内联样式。 – Blazemonger
这可能是嵌入式样式在运行时被javascript添加,看起来像[masonry jquery插件](http://masonry.desandro.com/)? –
嗯,既好评,谢谢,由于某种原因,我没有想到!重要的是,它会在下面的内联风格之前被解析,但我想这会破坏!重要。至于JavaScript的建议,我会检查出来的谢谢。 – Smokescreen