I have a website with Drupal CMS behind it. I use a custom theme and I would like to change it but I am not sure if it is entirely safe, i.e. is it possible to lose some data, design, etc if I switch it back to my theme? What about blocks and their position if the theme uses different blocks layout. Thanks.
It should be safe, but you should have a current backup of the database and files anyways. You can (and probably should) set the administration theme to one of the standard themes, so you can't lock yourself out of the admin section if you break your custom theme.
If the regions are named different (or missing in one theme) you may have to move your blocks. The blocks are set seperately for every theme, so just enable the second theme (without setting it a default) and set the blocks for this theme. After that you can set the theme as default.
I use a copy of the website to try out bigger changes to the site, so that I never break the live site. It makes it much easier and safer to just try out stuff.
Blocks are configured per theme. You won't lose any data.
You will not lose any data but your block positioning may change depending on how the theme is set up.
Like some others have said, you won't lose data, but I've typically had to position the blocks when changing themes.
If you enable the new theme (don't set it to default yet) you can setup the blocks before you go live with it. And if you allow certain users to change themes, you can view and tweak it.
Like everyone else said, you will not lose data. I would like to add if you switch from a theme that has, say two columns, to a one column theme, the blocks from the second column will have to go somewhere (they would need to be manually set).
You won't lose any data, though you might have to re-position the blocks as per the new theme layout.
Related
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.
I have an ecommerce site's header and footer built using drag and drop builder. When I shift the parent theme to child theme, all of the customization of drag and drop are lost. What could be a way to load a child theme without losing the parent theme customization?
Unfortunately, the Problem is each theme saves its data separately in a different row of the same table either it's parent or child. WordPress treats them as a single theme. So, you have to again re-create child theme. You can do it faster as you know what modifications were done.
For more information.
get the settings into the child theme
Child themes should inherit parent theme customizer settings on activation / switching
Child themes should inherit parent theme customizer settings on activation / switching
Hope this will helps you.
OK, so from what I understand is that this problem is dependent on how the parent theme you start with has been programmed. I happened to encounter this problem with the WP twentyseventeen theme, which I might have expected it to handle the theme_mods_ options better.
Anyway, one of the links listed by Sunil had a post written by Laura Kohan identified a couple of database entries that contianed all of the customizer options related to the child theme. In my case, I am using the twentyseventeen theme as the parent, and I was only able to identify one database entry that was pertinent to the situation and seemed to store relevant data about the child theme, and that was the theme_mods_twentyseventeen_child option in the wp_options table of the database. I noticed that the theme_mods_twentyseventeen option contained all the customizations from the parent in the form of a long array, so I simply decided to copy that array to the child's field. Of course, it would be smart to, save the child theme_mods_ option in a text file, or elsewhere before overwriting it with the parent data, but, for me, getting the customizations that I wanted was as simple as that...
For those people who don't know how to access the database, BEWARE!, changing data like this is not usually a good idea. You have to be very careful because often, some database entries will reference other entries, and it can get really messy. In fact this entry references custom_css_post_id, and possibly some others that you may want to consider carefully if you want keep the value from the child ID or use the one from the parent... But to point you in the right direction, most web hosting services will have PHPMyAdmin available for you in the cpanel, from there you can view your database, and from there find the table called wp_options, in which you'll find the relevant entries/options. And like Laura's situation, other themes may have some other extra entries to consider so be careful with that as well.
I think there might be a better way of directing WP to use a particular set of "mod" options in the child functions.php file, but so far I have not seen a good example of that. It would be nice to see some examples for: (1) referencing the parent mod options, (2) referencing the child specific mod options, and (3) copying the parent mods to the child mods. (another link by GreenShady in Sunil's post had some code that looked like it might do the copying, but I couldn't get it to work, perhaps someone else can provide a better example.)
Anyway, good luck...
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.
I am a Wordpress Theme Developer (Freelancer) and I make somewhere between 1-2 Themes / Week so I need a Quick way to make this happen.
Examples:
I use twentyten every time, delete the functions that I don't need, the CSS, images etc. I kinda let it "naked". (Not a quick way, maybe a personal framework?)
I search for Wordpress functions (since I can't remember all of them), on Wordpress Codex and again, not a quick way. So, do you guys think that a personal Function DB would be ok for me?
And more other stuff that I can't remember right now.
How do you guys organize your workspace?
If the themes you make are fairly similar, you might want to create that "naked" version and keep that as your base for future work.
I've created a handful of themes myself and I followed the same approach. I take that base theme and create new versions of the particular files that need to be customized.
However, if your themes vary quite a bit in form and function (being a freelancer, I'm certain they do), you may still want to create a library of functions and stylesheets rather than re-implementing everything for each project. Even if it means creating functions that call single Wordpress functions with default values, if it streamlines your workflow then it is well worth the minor overhead.
I think it's really a matter of personal preference, what works for you, what's easy to remember, what makes sense to you, etc. If you like starting with a stripped TwentyTen theme, then take that theme as a whole, strip it of everything you don't want, and then use that as your starting point for each theme you build. Certain functions that you find yourself using over and over, you could simply place in the functions.php file, in the theme folder. Then, which ever functions you end up needing for that specific theme are there, and the rest of them you can delete once you've built the theme.
First, it would be useful to develop your own theme as a starting point. Ripping stuff out of twentyten is really inefficient. If you develop one that has everything you need, you can do the second step:
Use child themes. A child theme will keep the parent untouched and you only have to change the things that you need to be different and add a new stylesheet. A big benefit is that it only consists of the stuff that is specific to that particular site. The generic stuff stays in the parent theme. Also you have the benefit of updating the parent easily and adding upgrades across multiple sites quickly.
A good starting point might be to try one of the frameworks like Thematic.
Also take a look at Automattic's toolbox theme. Twentyten is kind of messy and bulky. Toolbox is actually meant to be used more like you are using Twentyten.
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