I put some CSS codes in WordPress Customize Appearance> Customize in my case Additional CSS option, but I don't know if it is safe to put them there or not, since if the theme may get updated I afraid of losing them.
You can add code safely to the customizer area, it's kept in place even when updating the theme. A Child Theme is nevertheless even more recommended due to the more granular control.
Yes, You can add your additional css there. This is meant to be there for the same reason and your code will not be washed out even after updating your theme or plugins or wordpress until you change the theme.
Related
Hi there I've been fiddling with a problem and am hoping for a straight forward answer before I invest a lot of time in customising this theme.
I'm using an EDIN Wordpress theme and I need to change the color and feel of the website. Basically - I want to replace all the #xxxxx color with my own #xxxxx color.
Normally I would grab the Edin theme - CTRL+F the color, and replace it with my own.
However, I learned It's better to create a child theme, and customise from there. The problem is, now i can't CTRL+F the color and replace it with my own and I am using chromes developer tool to figure out where all the colours are located. So I've done a couple, no problem. But it looks like I need to do it for every media query the theme is coded for.
What I'm actually looking for is:
turn all #xxxxx into #xxxxx
Does this exist? If not, whats the best way to go about changing the main color of the theme - which is blue, and found all over the website.
After making a child theme - the CSS stylesheet is completely empty. This is making it difficult for me to find all the parts of the website.
Any help would be greatly appreciated.
Nathan the best thing would be to copy over the stylesheet from the parent theme into your child theme and then make all your changes to that. Your child theme stylesheet will then be used instead of the one in the parent theme. WordPress looks at the child theme first for files, then the parent theme.
If you have the time you could then go and find all your changes and copy them out one by one into a new stylesheet and then use that instead like an override.
The thing to keep in mind is if the parent theme updates... if so then if you are overiding the stylesheet and they make any updates, your child theme will not get those updates. In that case it is worth the time to make the new style sheet containing just your changes.
You would have to change everything manually. Unless there is an implemented option already in the admin panel to change colors etc, not all themes have this option.
The example you gave how to change all the colors at once, it is doable if you are using less. Then you can change same colors or parameters in one place and it will change it everywhere. I would have posted this in the comment section but I don't have enough rep yet.
This is just my opinion, maybe someone will do some research on your theme and will give you a better answer. Cheers
I'm mainly interested in adding classes to a few of the containers in one particular plugin - so I can style those elements. I've saved the .php files, and kept notes of the changes, but cannot find a solution (if any) to maybe create a child plugin that will preserve my edits.
Thanks!
Not really. That's why plugin authors are encouraged to include hooks for other plugins to customize their behavior.
You could create a diff file with your changes and use it to try re-applying your changes after an update, but you might run into difficulties if the plugin code changes substantially.
I am going to develop a child theme based on Canvas by WooThemes and I have one simple question: Since a lot can be configured from the theme admin panel, should I use that, rather than pure css in the child theme? For example, if I was to set the body background, should I do it like that, or would it be more recommended to write a single rule of css?
If you can finish everything up in the theme panel, there's no need to write a child theme.
If you have other reasons for writing it, however, keep in mind that options (i.e., everything you do in the admin panel) will not transfer to other sites. Changes you make in the stylesheet will travel with your theme.
Ah you know creating child theme is really good when you want to update your sites time to time.
When you want to make different version of the sites you can make child theme. Do whatever changes in your styles and push to update the theme.
Here's the situation: There's a WordPress plugin in place that enables a mobile-friendly theme if a mobile User Agent is found (with the usual details and logic, not important).
This mobile theme is copied from the plugin directory, into another, and overwritten when updates to the plugin come out.
I need to provide some extra custom functions for the theme, but don't want to put all of the code directly in the mobile plugin/theme, because it may get overwritten.
I think the best thing might be to put my special/custom functions into their own plugin, and deal with the theme-specific changes as they come up - that way there's less to diff/compare when updates come out.
What do you think is the best approach with something like this? Is there a safe alternative to creating my own plugin, where I can store some custom code?
You could make a wordpress child theme, so that if the parent theme gets updated all your changes remain intact. From the above link:
...the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)
That should allow you to do what you need to do.
What think to be consider when you prefer coding a solution in form of child theme rather then in form of a plugin ?
Themes and plugins solve different problems: plugins are for business logic, themes for presentation. They are not interchangeable. I prefer the right tool for the right job. :)
i prefer in child theme (or in function.php), rather then in form of plugin. It's more easy to reuse. You can just move it from one theme to another.
Any generic functions should be in a plugin. That way, they are available to all themes, and if you make changes in one place, you don't have to copy and paste to several files.
The benefit of a child theme is that you can make changes to an existing theme, such as twentyten, without directly modifying the source code, which is fragile -- it can cause errors and has to be repeated every time the theme is updated.
Depends on the situation. If it's something that could readily be used by any (or many) different sites regardless of the theme, I do a plugin.
If it's something specific to This Particular Site Only, I would probably put it in the child theme's functions.php. Even if specific to the one particular site only, I might make it a plugin if it's something I might want to turn on and off later.
Other than the fact that you can turn plugins on and off, there is little if any difference between code in a plugin and code in functions.php.
If it's something most easily coded straight into the theme (e.g. a particular permutation of the_loop) then of course just do it in the theme template and put supporting code in functions.php