Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there 👋

    In my opinion, if it is related to the FrontEnd, I would definitely recommend using templates files. And, when t it comes to background processes, I’d go with adding functions to funcitons.php.

    Also, here is an article which could be useful for you:

    https://wpmudev.com/blog/why-you-shouldnt-use-functions-php/

    I hope that helps 🙂

    Really it comes down to how you want yourself and potentially future developers to manage your modifications in the future and if you want to be able to easily enable/disable them. There isn’t really a right or wrong way and 6 million ways to code, but adding everything to functions.php can become unmanageable if you have a ton of customizations.

    Aside from the ways you did it, for ease in enabling/disabling and future management, you could create a custom plugin or use a plugin like PHP Code Snippets to manage all customizations. Both would be ideal for anything that’s completely custom or existing functionality that’s hookable. Sometimes what might need to be changed can only be done through templates.

    On client sites that do not have an existing child theme and refuse to have you create one, I opt for PHP Code Snippets since any changes made to their parent theme could potentially be overwritten in future updates. The plugin is also user friendly for anyone working on the site in the future where they can easily see and control all customizations and know what they are for and what they do as long as you provide meaningful names and descriptions.
    https://wordpress.org/plugins/code-snippets/

    Thread Starter richsadams

    (@richsadams)

    Thanks @gabrielfuentes for the advice and link to the interesting article. I think I’ve read its evil twin… “Use as few plugins as possible”. 😉

    Over the years, I think like you, I’ve developed a more-or-less hybrid work ethic since I’ve been burned by ill-formed plugins or outright abandonment as well as poor code scripts, snippets and choices.

    In general I’ve tried to follow the golden rule, “don’t mess with core files”, period. I’ve stuck to that for the most part but Woocommerce is a bit of a different animal. Some of the files date back years while others are updated more often. That’s always the worrisome element. Customizing leaves the site vulnerable to updates not only by the devs, of WC in this case, but other plugins and site code updates that can, through no one’s fault directly, interact and break small things or the entire site.

    So I’m a firm believer in child themes and keeping things as simple as possible. But let’s face it, WC is not a simple plugin by any measure. It’s great but can be a challenge when it comes to making it do what a client would like.

    Thanks again, much appreciated!

    • This reply was modified 2 years, 10 months ago by richsadams. Reason: Typo
    • This reply was modified 2 years, 10 months ago by richsadams.
    • This reply was modified 2 years, 10 months ago by richsadams.
    Thread Starter richsadams

    (@richsadams)

    Thanks also to @mtg169 Code Snippets is a “go to” plugin but I only use it on staging sites and then most often to locate the string I’d like to modify. Then I head to the original files to see what can be accomplished behind the scenes.

    As mentioned above, I’m leery about adding plugins that can do serious harm by others that have access, even unintentionally. I know I could hide it from other Admins – with yet another plugin – but I tend to prefer keeping customizations under the hood for the most part.

    If I get hit by a bus a decent developer should be able to sort out what I’ve done inside the child theme’s files. I always, always add an explanation to all coding for those that follow plus every client has a “Tweaks” file to pass along.

    Thanks again and welcome any other insights!

    • This reply was modified 2 years, 10 months ago by richsadams.

    If file editing isn’t disabled with define(‘DISALLOW_FILE_EDIT’, true) in wp-config.php, any admin could do just as much damage in the theme or plugin editor from wp-admin. At the agency I work for, I almost always create a custom plugin for all customizations that would typically go in functions.php so that anyone else could easily find or deactivate.

    IMO, it’s better to use hooks over template overrides if possible for maintenance reasons. If you work with WooCommerce enough, you’ll know the core templates eventually get updated. When that happens, you’ll have to use a file diff tool in order to copy your existing changes to all the new templates. From experience, I can tell you that’s not very fun if you have a lot of template overrides. Fortunately template updates are never usually breaking and you might be able to get away with not updating them, but savvy clients will question why they show outdated in the status report. I’ve seen some devs just change the template version to get rid of the notices, which I’d not recommend.

    Thread Starter richsadams

    (@richsadams)

    Thanks, all good info @mtg169. I may give an MU plugin a shot and see how it goes. 👍

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Thank you for the insights @mtg169!

    We are happy to help 😃

    Great! I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Cheers.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WC Template Modification Advice’ is closed to new replies.