how to manage parent and child theme? - wordpress

I have learned & read many documentations on parent/child themes but I have a doubt about managing both themes in one word press website. I have bought a word press theme, both parent & child themes came in the package, I have setup the parent theme as usually and have uploaded the child theme also but not activated it I have activated the parent theme only and imported the dummy data.
It is fine till now but what my doubt is do I have to activate the child theme (Or) parent theme if I want to edit the core .php files & styles of the parent theme. As per the rules if I want to edit any core files or styles I have to edit the child theme only because if I edit parent theme if the theme gets updated in the future then all my changes will be gone. If you have made changes to the theme’s core files, as soon as the update is complete, you’re 100% guaranteed to lose any changes that you’ve made.
How to manage child theme & parent theme? Which theme to activate is it child theme or parent theme only? Thanks.

The purpose of Child theme is to edit/customize anything you want.
I see you have got all idea about child theme except ONE thing. - Copying.
If you have to edit something and it is in parent theme - JUST COPY THAT FILE to child theme and edit it in child theme.
WordPress would read that file from child theme first, if it doesn't exist, then it tries to load it from parent theme.
And one more thing: NEVER edit any file in parent theme - it is useless as you know - updates would erase them.
That's why final rules are simple:
active theme should be child one.
copy a file to child theme in order to change something in it.

Related

How to move all modifications made in a parent theme to a child theme?

I'm working upon a Wordpress project, and due to my inattention, I started to make all the modifications in my parent theme, which I installed in.
Now that I realised, that I should work with the child theme instead, I've put it, and the issues that I'm confronting with, is that all the logos and backgrounds which I've added, are now set to default (if I switch to parent theme, everything is good). Is there an easy method of moving all these changes from parent theme to child?
Also, in the parent theme, I've edited the 404.php file, will it be reverted back to normal, if there'll appear an update to the theme or not? If so, is it possible to move the modifications made in parent theme's 404.php to the child theme?
You shall first make a copy of the parent theme you have created lets call it modified-parent-theme.
Then import the original parent theme you chose (lets call it clean-parent-theme).
And Create an empty child theme as described here:
https://developer.wordpress.org/themes/advanced-topics/child-themes/#how-to-create-a-child-theme
Associate it to the parent theme you wanted to use in the main stylesheet: style.css
/*
Theme Name: Your Child Theme
Template: clean-parent-theme
*/
Then you can simply move the files you modified from your theme folder (modified-parent-theme) to the child theme directory.
Those files (like 404.php...) will override Parent theme's files automatically and you will keep the ability to update your parent theme without losing customisations.

How do child theme work for existing projects in wordpress?

I have created child theme for one of my existing project, How will it be usefull?
If i update parent theme all customization will be go away, What can i do in this scenario?
No, a child theme will supercede the parent theme. So even if the parent theme is updated Wordpress will take any data from the child theme that is present.
It is useful for giving you greater customisation and allowing you to create very specific templates, for specific kinds of post types and navigation, for example.

Css modified after wordpress update

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.

Theme child on wordpress

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

How to hide theme feature in a custom css box wordpress

class="hero-play-btn various fancybox.iframe"
Is it possible to hide the above class in a custom css box in wordpress?
It is coded in by the theme we are using. And I have no need for it.
You can add a child theme in wordpress, and set display:none for the elements you don't need from a stylesheet within the child theme.
Read more on child themes and how to make them here:
https://codex.wordpress.org/Child_Themes
If you have direct access to the theme installed, you can find and hide/remove the elements. Be aware that any changed to a theme will be undone if the theme is updated in the future. Hence why we use child themed for such tasks

Resources