简体   繁体   English

WordPress的插件和主题CSS Colide

[英]wordpress plugin and theme css colide

I have a small problem! 我有一个小问题! Im using a Wordpress theme, and a Plugin from a real-estate system developer witch fetches data from the system.. 我使用的是Wordpress主题,而房地产系统开发人员witch的插件则从系统中获取数据。

IF i use the theme the real-esate system recommends everything works smoothly. 如果我使用主题,那么Real-Esate系统会建议一切正常进行。 But i want to use a nother theme. 但是我想使用另一个主题。

The result of this is that the data fetched from the Plugin is not looking like intendend. 结果是从插件中获取的数据看起来不像预期的那样。 The Theme CSS takes over hand.. and uses the themes css on sertain elements like .li and .ul... 主题CSS接管了..并在.li和.ul等某些元素上使用主题css。

Is there a way to solve this? 有办法解决吗? I dont want to use iframes. 我不想使用iframe。 Can i eg create a div, and then apply the Plugins style.css to that div and to that div only. 我可以例如创建一个div,然后将Plugins style.css应用于该div和仅该div。 and in just that div override the css from the theme? 只是在那个div覆盖主题的CSS?

if u want to look at source and css and so on here is the link: http://hogmans.nu.temp-url.se click on "till salu".. 如果您想查看源代码和css等, 点击以下链接: http ://hogmans.nu.temp-url.se单击“耕种”。

if u want to look where the plugin is presented correctly http://hogmans.mspecsweb.se/till-salu 如果您想查看正确显示插件的位置, 请访问http://hogmans.mspecsweb.se/till-salu

u se the problem? 你有问题吗?

looks like it is using two different css framework.. 看起来它正在使用两个不同的CSS框架。

try adding this line of code into your header 尝试将这行代码添加到标题中

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

It will fix the middle part for sure... but not so sure what it will do to your site as a whole.. 它肯定会修复中间部分……但不确定它会对您的网站整体产生什么影响。

also there is no easy fix to this other than using a theme that is powered by the newest version of twitter boostrap or create your own custom mobile css to make those single lines into blocks again. 除了使用由最新版twitter boostrap提供支持的主题,或者创建自己的自定义移动CSS再次将这些单行变成块之外,没有其他方法可以轻松解决此问题。

You have a few options: 您有几种选择:

  • If you save the stylesheet you want into your theme's core files and import it in your theme's header AFTER all the other stylesheets, those styles will take precedence over the theme's styles (though this might not work for all of the styles since it depends on how the theme's stylesheet is coded - for example if there are any !important declarations). 如果将所需的样式表保存到主题的核心文件中,然后在所有其他样式表之后将其导入到主题的标题中,则这些样式将优先于主题的样式(尽管这可能不适用于所有样式,因为这取决于如何主题的样式表已编码-例如,如果有任何!important声明)。
  • You can also copy all of the styles from the one stylesheet and paste it at the bottom of the other, but you run into the same issues as the first option - it will most likely work, but it might not render as expected. 您也可以从一个样式表中复制所有样式,然后将其粘贴到另一个样式表的底部,但是遇到与第一个选项相同的问题-它很可能会起作用,但可能无法按预期呈现。 The same goes for adding the <style> tags to the header. <style>标记添加到标头也是如此。
  • The most reliable option you have is to figure out what styles you need from your preferred styles and create your own stylesheet that will render certain elements the way you need it to so you can control and adjust the css specificity as needed. 您最可靠的选择是从首选样式中找出所需的样式,并创建自己的样式表,该样式表将按您需要的方式呈现某些元素,以便您可以根据需要控制和调整CSS特异性。 If you need to, you can add a div around what you need to style, give it an id, and use that id before your elements in the stylesheet. 如果需要,可以在样式所需的内容周围添加一个div,为其指定一个ID,然后在样式表中的元素之前使用该ID。 Usually is is not wise to use ids for css, but since you are trying to override styles, this could be a quick and easy way of doing so. 在CSS中使用id通常是不明智的,但是由于您尝试覆盖样式,因此这可能是一种快速简便的方法。

**If you are using a theme that you did not build on your own, your theme might update. **如果您使用的主题不是自己构建的,则主题可能会更新。 Any changes you make to the theme's files will be overridden. 您对主题文件所做的任何更改都将被覆盖。 You will need to create a child theme to add or edit any of the theme's files. 您将需要创建一个子主题以添加或编辑该主题的任何文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM