自定义Disqus

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

我刚刚将 Disqus 集成到我正在开发的 Wordpress 主题中。除了 CSS 之外,一切都工作正常。 如何将我自己的 css 样式应用到 Disqus ?

在我的 .less 文件中,我写了这个:

#disqus_thread {
    position: relative;
    display:block;
    margin: 0 0 20px 0;
    padding: 20px;
    line-height: 1.5;
    color: @brandGray !important;
    background-color: @white;
    .flat-box-shadow;
    overflow: hidden;
    clear: both;

    iframe {

        body.dark {

            #layout {

                #main-nav {

                    nav {

                        a {
                            color: @brandViolet !important;

                            &:link,
                            &:visited {
                                color: @brandViolet !important;
                            }

                            &:hover,
                            &:active,
                            &:focus {
                                color: @lightViolet !important;
                            }

                        }

                    }

                }

            }

        }
    }
}

但是根本不起作用。我在网上搜索了一下,发现我的css样式不会被应用,因为Disqus是在iFrame中。我可以在管理面板中找到自定义 Disqus 的任何内容。那么,我该如何解决这个问题呢?

我在本地主机上工作。会不会有问题?

非常感谢!

css wordpress less disqus
4个回答
2
投票

重复 @Assaf 所写的内容,但是 disqus 样式的当前说明在这里

他们清楚地表明你不能设计所有的东西,只能设计一些选定的东西。例如,对于链接,您可以设置颜色,但不能设置太多其他内容。我在自己的博客上尝试过,它成功了

#disqus_thread a {
  color: red;
}

但我也尝试过这个

#disqus_thread a {
  color: red;
  font-weight: bold;           /* no effect */
  text-decoration: underline;  /* no effect */
}

根据这些文档,您可以设置。

  • 选择浅色或深色主题

    在管理页面的管理 > 设置 > 外观下设置

  • 设置段落和链接的颜色

    #disqus_thread p {
      color: green;
    }
    #disqus_thread a {
      color: red;
    }
    
  • 设置评论的宽度

    #disqus_thread {
      width: 700px;
    }
    
  • 如果您支付专业版费用,请添加您的徽标


1
投票

参考:http://casadeblundell.com/jonathan/custom-styling-for-disqus-css/

/* --- disqus css -- */

#disqus_thread {
color: #ffffff;
border-style: 0px solid;
border-color: #cccccc;
padding: 5px;
}

#dsq-content #dsq-comments .dsq-comment-body {
color: #fff;
background-color: #000000;
}

.dsq-reaction-body {
color: #fff;
}

.dsq-reaction-header cite, .dsq-reaction-header span {
color: #ccc;
}

.dsq-reaction-retweets {
color: #ccc;
}

/*--- end disqus css --*/

1
投票

由于 disqus 从其父元素继承颜色,最简单的方法是添加一个包装器并为其设置样式:

<div id="disqus-wrapper">
    <div id="disqus_thread"></div>
</div>
#disqus-wrapper a:any-link {
    color: #333; /* the color you want here */
}

-2
投票

更改 Disqus 背景的简单技巧。如果您使用的是“disqus-comment-system”插件,请打开comments.php 文件。并搜索 disqus_thread id。现在添加您自己的类。例如 :

<div id="disqus_thread" class="myclass">

最后将此类添加到您的 css 文件中。并改变你想要的任何东西。例如:填充、背景等 同样的技术也适用于其他讨论插件。

谢谢

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