I built a Wordpress child theme based on Thematic framework and edited some template files. When I upgraded to a new version of Thematic all changes to my template files were lost.
I guess it makes sense but that makes me a little disappointed in the child theme concept...
So if I understand correctly, there's no way to edit template files of Thematic (or any other WP theme framework?) and then upgrade easily and keep the changes? The way to modify a Thematic child theme is with styles and hooks, but changing template files is a no-no because all changes will be lost with upgrade?
By child theme, i'm assuming you just made some changes to that Thematic theme but for a specific blog, in which case, yes, your changes would of been over written on upgrade.
To avoid this, create a new theme folder on your sever and copy all the files over to that new theme. Once the files are copied, go into your stylesheet, and modify the comments in the header of the file. This is where you can rename your theme to say something like Thematic Theme Customized or you can rename it to whatever you want.
Once these two steps are complete, you should be good to make any modifications without fear of your data being erased on site upgrade.
Please note, that by going this route, WordPress doesn't know there's a new theme that it needs to upgrade, so if the Thematic theme has a system upgrade it needs to update, you'll need to copy that update over to your newly modified theme.
Hope this helps
Make sure you copy the childtheme out the thematic theme dir into the theme dir and edit the childtheme functions.php. Otherwise if you upgrade the theme changes will be lost.
Related
I have updated my WordPress version. The style of the css is modified. I have a backup version. Should I take the oldest file for plugins and theme in order to resolve that issue?
you should have a child theme and put your custom css in the css-file from your child-theme.
Your child-theme would not touch from any update and your custom code is save
Taken from the WordPress Codex:
WARNING: The upgrade process will affect all files and folders included in the main WordPress installation. This includes all the core files used to run WordPress. If you have made any modifications to those files, your changes will be lost.
When you do any theme changes you should always put your changes in either a custom theme you have made yourself (so only you update it), or if you're using someone else's theme, create a child theme.
More information about child themes can be found here:
A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying an existing theme.
As for plugins, they don't work in the same way so you'll need to make sure that any plugins you change are your own otherwise you'll lose the changes when you update them.
Lastly, you can also use the WordPress Customiser (Appearance > Customize in the dashboard) if you don't want a child theme but want to insert custom CSS. That allows you to edit CSS safely within the dashboard and keep your changes safe even when you update things.
I'm new on wordpress and I have readed about childs themes.
My question is, Is that neccessary that I create my self child theme or can I use other theme child created ? that's to say, if I use a child theme created for other person, that theme will not change that I do it?
The way a child theme works is that it overrides the default settings of your chosen theme. So you only have to allow for the parts of the theme that you want to make your own.
As long as a child theme created for someone else is based on YOUR main theme, then you could use someone else's child theme.
For example, if someone has a child theme that works for Wordpress 2017, you can upload and modify that for your own use, for example to change the css or create your own header and footer files (usually named header.php and footer.php). These are the things I do most often.
If you don't already have a child theme for your chosen theme, though, it is best that you create one yourself. It is quite straightforward, all you have to do as a minimum is create a child theme folder with a style.css in the correct format and a functions.php file in the same folder using these instructions https://codex.wordpress.org/Child_Themes
If all you want to do is play with color and fonts, you might find it easiest to just use the Wordpress Theme Customizer. These changes will be maintained during upgrades in a custom.css file (or equivalent) so you shouldn't need a child theme.
Hope this helps
I had 2 custom templates I used in core/bartik theme which got deleted after I updated drupal core.
Is it possible to "protect" those templates from being deleted?
Make your own theme. Inherit some existing theme if you don't want to start from scratch. Then copy existing templates to your theme and change them the way you like. Never change Drupal core files, including themes.
By changing core files you made updates almost impossible.
If you don't want to create your own theme or sub theme from scratch you can make Bartik to be your own custom theme by just placing coping of to live inside /theme directory.
So now you will have 2 "Bartik" themes
Drupal core's one in
/core/themes/bartik
and yours in
/theme/bartik
In this case drupal will use the copy inside /themes/barik
But, if doing so, it is highly recommended to go another step and rename your copy of the Bartik to be something like "My Bartik" by
Edit the theme name inside bartik.info.yml
Perform search/replace in all theme files of "bartik" into "my_bartik" (machine name).
Replace "bartik" also in file names.
Rename the theme directory to be your new custom name (machine name).
I am new to WordPress. And I want to set diffrent colors in the title of the customizr theme.
How could I finish that? I know that if withou WordPress, I could use css and span tag finish that like how to set different colors in html in one statement.
But how could I do that in a WordPress theme.
You still have to use css. If you want to edit the theme, locate the theme folder first. Go to wp-content/themes/customizr or whatever the theme folder is.
Usually the title can be found in few different files: single.php, page.php, index.php, etc., it depends from theme to theme. Many developers include templates inside each of these files too. Again, everything changes from theme to theme.
My recommendations is to create a child theme to perform any customization. Also I recommend reading the codex to know more about WordPress development and theme development, that way you learn more how things come together and work.
I am using wordpress! I have certain pluginsthat i use that I personally modified and made changes to.
I have even made edits to css files as well
I heard if you update the files , (when a update becomes available) the updates will overwrite the changes you have made
how can I avoid this?
**The theme I am using is not a child theme i believe
When updating WordPress, no theme or plugin files (except for the default WordPress themes maybe) will be overwritten.
When updating a plugin, plugin files will be overwritten indeed. A possible solution is – when that plugin is using hooks – to unhook and than re-hook them with your own copy of that function in the functions.php file of your theme. Furthermore, there is not much you can do.
With themes, it is best to create child-themes.