Change the style of a wiki post

A quick guide to change the style of your wiki posts:

Change the background color:

In your /admin/customize/themes add this CSS under Common > CSS

.wiki .topic-body .cooked {
  background-color: #dcffdc; /*light green*/
}

Change text size

If you want you can also change the font used or the size of the text, even the color

.wiki .topic-body .cooked p {
  font-size: 18px;
  color: green;
}

Add text

You can add a text to make clear to users that what they are watching is a wiki post

.post-info.edits .wiki::before {
  content: "EDIT THIS WIKI POST";
  color: green;
  background-color: #d2e2d2;
  margin-right: 3px;
  font-weight: bold;
  border: 1px solid green;
  padding: 3px;
}


This document is version controlled - suggest changes on github.

22 лайка

Hey, we just changed the background color of wikis on the Fairphone forum, but like all other posts each wiki starts out as staff-blue when you load it, then slowly turns white and only then turns green.
Is there a way to disable this animation for wiki posts?

I believe this should do the trick:

.wiki .topic-body {animation: none;}

6 лайков

Here’s a Theme Component which makes Wikified posts pale green again, and incorporates @Kris’s animation: none tweak. (I chose an essentially random pale green as I did this surreptitiously while I was supposed to be paying attention in a meeting. But you can change the RGB value in the Theme Component CSS after installation)

Improvements always welcome by pull request.

4 лайка

Можно ли сделать фон зависимым от светлой или тёмной темы? Буду благодарен за ответ.

1 лайк

Самый простой способ — создать два разных компонента темы: один для светлой темы, а другой для темной, чтобы вам не приходилось писать дополнительный CSS.

2 лайка

Чтобы кастомизации Wiki корректно работали в личных сообщениях с новыми изменениями, предлагаю внести небольшую правку в CSS, чтобы она применялась к .cooked:

// Настраивает посты Wiki
.wiki .topic-body .cooked {
    background-color: #e8f9fd;
    animation: none;
}
.post-info.edits .wiki::before {
    content: "Пост Wiki";
    margin-right: 5px;
    font-weight: bold;
}

Я также добавлю это в первое сообщение темы.


Позже…
А ради интереса я превратил это в компонент темы с возможностью настройки цвета фона и текста.

2 лайка