0

I need to display a custom checkbox / radio button on Twenty Sixteen's options which the administrator can select to display one of few custom CSS for example, to change the base colours of this theme. Someone has any idea that how can I do that functionality?

  • Can you please edit the question and explain a bit more of what you want? It's not clear. Also, perhaps add an screen shot of the admin theme options you are talking about. – Fayaz Apr 4 '17 at 10:02
0

This is a fairly broad question. There are many approaches thinkable, but here is the lay-out for an easy one:

  1. Build a child theme, consisting only of a style.css.

  2. Find the id of the highest level wrapper in the theme, let's say 2016id

  3. In style.css add style rules that depend on the class of the wrapper, like #2016id.style1 .widget h2 {color:red;} and #2016id.style2 .widget h2 {color:yellow;}

  4. Now you have to add a buttons to toggle the class like this: <a onclick='document.getElementById("2016id").classList.add("style1").remove("style2")'> Show style 1</a>. The simplest way to add it is to put it in a text widget that you include in your sidebar. Else you'll have to copy a template file to your child theme folder and edit it.

Read more about adding and removing classes on elements.

  • I'm not sure, but I think this question may be about the customizer ;) – Fayaz Apr 4 '17 at 10:00
  • @Fayaz on second reading, you could be right. The question has been changed from "user can select" to "administrator can select". – cjbj Apr 4 '17 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.