简体   繁体   English

自定义Wordpress的父/子注释?

[英]Customizing Wordpress parent/child comments?

Here is what I'm trying to do, and I understand the way that wordpress has it already set up, but I rely heavily on being able to modify and basically change whatever I need too, and in core files as well. 这是我正在尝试做的事情,我了解wordpress的设置方式,但是我在很大程度上依赖于能够修改和基本上更改我需要的内容以及核心文件中的内容。 However, I am using multisite so changing the core file's is now not an option. 但是,我正在使用多站点,因此现在不能选择更改核心文件。

The image below is somewhat how I am wanting the final product to appear, but I noticed other than using wordpress's ul, ol & li styles, I need to be able to customize it more than what has been provided by that, just in case you are wondering why I'm taking the hard way. 下面的图片是有点我如何我想最终的产品出现,但我注意到比使用WordPress的UL,OL和李其他样式,我需要能够定制它不止是什么已经由提供,以防万一你想知道为什么我要努力。

Anyways, looking at the image below, where the white rectangle is, I'm wanting to be able to change the color and ultimately allow myself to change the formatting to whatever I want that is different for all user replies. 无论如何,请看下面的白色矩形所在的图像,我希望能够更改颜色,并最终允许自己将格式更改为我想要的所有用户答复都不同的格式。 I have no idea how I'd write it, but more than likely it'll have to be an if/else statement. 我不知道该怎么写,但是很有可能必须是if / else语句。 Basically, it'll say: 基本上,它会说:

If parent (depth 0) comment, display this formatting, else (depth of 1 or greater, which would be a child reply), this display it this. 如果父级(深度为0)注释,则显示此格式,否则(深度为1或更大,将是子级回复),则显示此格式。 Any idea's? 有任何想法吗?

Here is my functions theme file and my comments theme file . 这是我的功能主题文件和我的注释主题文件 AND just in case, the comment-template file under the wp-includes that says how to display and label the comments as parents/children. 并且以防万一,wp-includes下的注释模板文件说明了如何将注释显示和标记为父母/孩子。

样品

I'd also like to point out, that I'm looking for help and suggestions, not criticism. 我还想指出,我在寻找帮助和建议,而不是批评。 If I knew the answer, I wouldn't be asking for help. 如果我知道答案,就不会寻求帮助。

Based off of what BDHorrigan said, I came up with the following: 基于BDHorrigan所说的内容,我提出了以下建议:

blockquote {
  background: #292929;
  border-left: 7px solid #00D9FF;
color: #A3B808;
  margin: 1.5em 10px;
  padding: 0.5em 10px;
}

blockquote:nth-child(1) {
    border-left: 7px solid #FFBE40;
}

This allowed every child reply to be the same because they would be all at a nth-child of 1. Thank you! 这使每个孩子的答复都相同,因为他们的第n个孩子都是1。谢谢!

If it's just colour you want to change, is there any reason you can't just use CSS? 如果只是颜色要更改,有什么理由不能只使用CSS? Eg make a rule for li.depth-1, another for li.depth-2, etc.? 例如,为li.depth-1制定规则,为li.depth-2制定另一个规则,等等?

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

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