Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
885 views
in Themes by
I have been trying to customize Q2A for about three day and I have not moved an inch. I know CSS and HTML and I can customize any Wordpress theme, for example, but customizing Q2A and its themes is practically impossible. That is why all websites running on Q2A look exactly the same. How is this framework organized?  What is outputting what and how are CSS classes for php/html elements determined in themes - SnowFlat theme? For example, I want to remove the title link on single question pages. It is redundant. Cannot seem to find what is outputting the a tags. Also, CSS classes for certain elements are the same for classes of unrelated elements. For example, when I change the h1 title color and background color of a single question page, I am also affecting h1 elements of other pages (Categories, Unanswered, Users...). Those are just some examples. I have found many other examples, when you change certain properties of a class you affect other logically unrelated elements, because they are all using the same class. Can someone help with basics for customization?
Q2A version: Latest

1 Answer

+2 votes
by
edited by

I know CSS and HTML

If you want to make some CSS changes that's fine. If you want to restructure your site, then you will need to know PHP as well.

How is this framework organized?

That is a very generic question. Please, be more precise, otherwise, it would be hard to find the motivation and time to answer it.

What is outputting what?

That's a funny question. Themes and layers output HTML, CSS and JS, as you can check in the docs: http://docs.question2answer.org

How are CSS classes for php/html elements determined in themes - SnowFlat theme?

I'm not sure what you mean by "determined" but the classes are usually dynamically built, starting from the base theme, overridden, if necessary (but not advisable) by the themes, and then by the plugin layers. This also applies to the PHP methods in them.

Cannot seem to find what is outputting the a tags

I just did a text search in my IDE of <h1. That yielded around 10 results and one was the base theme and the other filenames were considerably irrelevant. Probably, you're not using the right tool to work.

when I change the h1 title color and background color of a single question page, I am also affecting h1 elements of other pages [...] because they are all using the same class

The first C of CSS stands for Cascade. That means you can have 2 classes, tags, etc., with the same name inside different DOM hierarchies. If you style the <h1> tag you are styling everything. If you style the selector body.qa-template-question h1 you would be styling only for the question display. You can perform more advanced styling using PHP as explained here: http://docs.question2answer.org/themes

Conclusions and advice:

  • If you want to change CSS you just need to know CSS
  • If you want to restructure the HTML, you will most likely need to know PHP as well. The more PHP you know the more complex customizations you will be able to do
  • You should read the documentation. It is not much but it helps
  • You should read and understand the base theme code, a theme code and some layers code
  • A lot of trial and error is a must
  • The more radical the change in the HTML structure, the more chances you will have to break a plugin
by
+1
Very good answer.

Fundamental reason why Daca thinks that customization of Q2A' look and feel is difficult may be difference of the theme (template) system between WP and Q2A's.  In the WP template, HTML is mainly described, and PHP is described only when necessary. This means that even people who do not know PHP can customize it. On the other hand, in Q2A, almost all HTML is output by PHP. This means that people who do not know PHP can not customize Q2A. For users who do not use PHP a lot, Q2A will appear in a very difficult system. But on the other hand, I think that the Q2A overridable and very flexible layer (theme) system has the potential to surpass WP.

> Daca
I often use WP. Please examine Q2A as a different system with a different architecture. By well inspecting, you can understand why pupi and I, and other users can not leave this system.

Hope daca's helps.
by
edited by
Thank you. That makes sense. In practice, if you know WP, you'll find it easy to customize WP. If you know Q2A, you'll find it easy to customize Q2A. Same as everything in life :)
...