If your way of reusing custom code across projects is to copy and paste, this one’s for you. Come learn how to streamline your development cycle so you can take on more work from more clients. Instead of adding or making changes to a custom function on a site, by site basis – develop custom code in a single location so it can be reused across projects efficiently.
We’ll explore advantages to separating functionality from design with custom plugins and discuss why a centralized distribution strategy is critical to scaling development services. After this brief discussion, we’ll spend the majority of our time implementing such a strategy for a simple custom plugin.
Walk away with:
– Dedicated location for the development and maintenance of a custom plugin (GitHub)
– Scalable distribution and update strategy for custom plugins and themes
– Basic Git skills
7. @rachwhitton 7
Move Custom Code to Plugins
Using site-specific plugins..
‣ Easily re-use common functions across projects
‣ Site’s functionality remains intact when swapping themes
‣ Dedicated location for development and maintenance
9. @rachwhitton 9
wp scaffold plugin
Docs: https://developer.wordpress.org/cli/commands/scaffold/plugin/
Toolbelt:
‣ Terminal application
• Demo uses iTerm2 with oh-my-zsh shell
‣ Local development environment with Git and WP-CLI
• Demo uses Lando (developed by Tandem)
12. @rachwhitton 12
Git & GitHub Demo
‣ Copy the new plugin to it’s own project
‣ Initialize the plugin’s root directory with Git to add version
control
‣ Create a repo on GitHub
‣ Add the remote
‣ Initial commit
‣ Push
16. @rachwhitton 16
wp scaffold child-theme demo
Docs: https://developer.wordpress.org/cli/commands/scaffold/child-theme/
Toolbelt:
‣ Terminal application
• Demo uses iTerm2 with oh-my-zsh shell
‣ Local development environment with Git and WP-CLI
• Demo uses Lando (developed by Tandem)
Sanity - tell the story about dell developer
Scalability - important of reusing code
Sustainability - update distribution strategy
I was having lunch with some friends, and through some mutual acquaintances I met a young developer who just accepted a job at Dell as a software engineer. I asked what kind of work he had done in the past and he answered WordPress and my eyes popped. Finally someone to talk to! None of my friends can really relate to this kind of work so anytime I meet someone out in the wild that knows what WordPress is, I instantly fan girl. Well this new friend was not a fan. He had just left an agency in the area and he was glad to be whipping his hands of WP for good. He had a terrible experience with it. When I asked what happened? Why was it so bad? He said, each developer had to re-invent the wheel for every single project. “We didn’t have a way to re-use code so we ended up copying and pasting from here to there for this and that” I could tell he was flustered just thinking back on it all.
Having a centralized distribution strategy for updates
Lando start
Open local site plugin page
Run scaffold command
Return to local site plugin page
Take custom code you just created and create a repo for it
github.com/new
Take custom code you just created and create a repo for it
Lando start
Open local site plugin page
Run scaffold command
Return to local site plugin page