Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

Could you point how to create a custom plugin to prevent that our customizations are lost during updates?

Hi Experts

Could you point how to create a custom plugin to prevent that our customizations are lost during updates?

Directly customized theme functions.php

User generated image
I followed these steps, but something else must to be done to get it working.

1. Create a folder and a file under plugins' folder to customize to avoid directly customize functions.php

User generated image
2. The plugin is now avaliable
User generated image
3. But if it's selected, it doesn't exists.
User generated image
Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey Eduardo,

You need to make sure you've removed the relevant code from the functions.php file - you'll get an error if the same code exists in functions.php and your plugin file.
http://wpcandy.com/teaches/how-to-create-a-functionality-plugin provides good detail about developing site functionality plugins.

And the link you show above relates to a theme, not a plugin, so likely best to create a Child Theme for you specific situation.
Avatar of Eduardo Fuerte

ASKER

Hi

@Chris
I removed the relevant code and the error persisted.

@David
After following  
create a Child Theme for you specific situation
sugestion everything runs ok...

My doubt is: if it's a much more easyer alternative why is it asked to create a custom plugin?
/**
 * Note: Do not add any custom code here. Please use a custom plugin so that your customizations aren't lost during updates.
 * https://github.com/woocommerce/theme-customisations
 */

Open in new window

Since accordingly to the lessons I had at Youtube, to create a Wordpress plugin is a complex task... Could you explain?
Creating a plugin is as easy or as complicated as you need it to be. For some simple customisations like yours, it really is very simple. Don't know why it's not working for you - I had exactly the same code and it worked fine, so I would suggest going back over it and double-checking.

Whether you use a plugin or a child-theme will depend on your needs. If you want to customise WooCommerce, use a plugin. If you want to customise your theme, use a child theme.

The reason they suggest creating a plugin is that it's independent of the theme you use. If you create a child theme and add the customisations to your functions.php file, they are only available for that child theme. If you decide to switch themes, you would have to add your customisations to the new theme (and every other theme you wanted to use).

By using a plugin, you are customising WooCommerce itself, and not just the theme, so those customisations will persist throughout your website, no matter which theme you use.
@Chris.

Sorry my misconceptions.
I'm getting the concepts I need by better reviewing your answers.
Thanks for help!
Go through the article I referenced, which has a great table of how to approach different tasks.

In other words, if task is best done at a theme or plugin level.

If you get stumped, just hire someone to work through this with you.