WordPress Development Best Practices and Tips by GS Web Tech Developers
WordPress Development Best Practices and Tips by GS Web Tech Developers
WordPress is facilely the most puissant open source blogging and content management system available online today, and so working cognizance of its intricacies is a boon to any developer or designer resume.
This resource contains an accumulation of WordPress development best practices and WordPress development tips provided by our GS Web Tech network members. As such, this page will be updated on a conventional substratum to include supplemental information and cover emerging techniques. This is a community driven project, so you are enheartened to contribute as well, and we are counting on your feedback.
Check out the GS Web Tech resource pages for adscititious information on WordPress development; there is a WordPress developer hiring guide and WordPress developer interview questions.
GS WEB TECHNOLOGIES WEB DESIGN AND DEVELOPMENT COMPANY IN CHANDIGARH
Utilize Child Themes and Plugins
An abundance of newcomers to WordPress dive right in and commence modifying their core theme files. This is a definite mistake. All of your vicissitudes will vanish right after an upgrade, and since plugins and themes are updated about as often as apps on your phone, this is pretty frequently.
To eschew this, engender children of your plugins and themes. Not only will you preserve your transmutations, you can upgrade on your own time. The same steps used to engender a child theme can be applied to engendering a child plugin, but let’s use engendering a child theme as our example.
To get commenced making your child theme, engender an incipient folder in your themes folder with a unique denomination, then engender a style.css file in your incipient folder.
In WordPress, all theme parameters are stored in the style.css file as the first comment block. Open the style.css from your pristine theme, the parent, to optically discern an example of this.
For your child theme, go ahead and facsimile that comment block from your pristine theme’s style.css to the incipient file and rename it. Integrating the template parameter to this header will link your incipient theme to the pristine. The Template parameter should point to the folder name of the pristine theme, like so:
/*
Theme Name: Twenty Fourteen Child Theme
Description: My incipient child theme predicated on Twenty Fourteen
Template: twentyfourteen
Version: 1.0
*/
Now, if you optate to modify files of the pristine theme, copy them from the pristine theme’s folder and paste them into your child theme folder. WordPress will utilize pristine template files unless it visually perceives the same file in your child theme. So if you optate to make changes to header.php, copy it from your pristine theme into your incipient child theme folder, and make the transmutations in the facsimile. For integrating incipient or modified code, you likewise engender an incipient functions file in your child theme and make your vicissitudes there.
This same file replicating strategy goes for many plugins as well: engender a folder with the same name as a plugin inside your child theme, and then adhering to the file structure of the pristine plugin folder, copy files from the pristine plugin to your incipient folder and modify them. Most major plugins support this, but it’s always good to check with the author if you are not sure.
GS WEB TECHNOLOGIES WEB DESIGN AND DEVELOPMENT COMPANY IN CHANDIGARH
Expidite Things with Caching
WordPress optimized hosting accommodations such as Siteground, or the more extravagant Wpengine, automatically support WordPress caching. If your host is one that has WordPress categorical caching available, it’s the best option.
For those running on a VPS server with root access, Google PageSpeed is a turn key caching and optimization solution by Google that works with Apache and nginx. If that’s of interest to you, check out this guide on how to install PageSpeed on Plesk with CentOS.
Pay Attention to Security
WordPress’s popularity makes it a high priority target for hackers. If you don’t update often, you are pretty much asking to get your site hacked.Automatic updates are a little too dangerous for users with a lot of customizations and plugins, which is why I strongly suggest installing some sort of security plugin.
I personally recommend iTheme Security, which implements security options like a password lockout and file monitoring. And Wordfence Security, a WordPress specific firewall for your site.
Three Developer Implements to Make Life More facile
WordPress has many plugins and integrate-ons to make your developer life a lot more facile. In particular, I recommend:
WP-Cli
WP-Cli lets you work with WordPress utilizing the command line. With this great implement you can upgrade and downgrade WordPress in seconds, as well as update plugins. Eminently, when you find yourself migrating to a different server, the built in search-supersede command will take care of all the url changes for you, and it’s worth installing it simply because of that.
Advanced Database Cleaner
The Advanced Database Cleaner plugin cleans out spam comments, built in revisions, and transients. You can even set up tasks to run automatically.
Query Monitor
When things are running gradually and you’re not sure what to inculpate, Query Monitor lets you optically discern what queries are taking too long to execute, as well as show you PHP admonishments and errors.
Don't Overdose on Plugins
Yes, WordPress has tons of plugins, but that doesn’t mean you should install them all. The more plugins you have, the bulkier your site and the slower your loading times, so don’t use plugins unless absolutely necessary. If you only need to add a few custom fields to your posts (a functionality already included in WordPress) don’t overengineer the solution by installing the advanced custom field plugin, ACF.If you must use a lot of plugins, make sure you have Plugin Organizer installed to manage them. This great plugin lets you specify what plugins are activated on which pages (you can even use regular expressions), and this selective loading will significantly speed up your site.
Although great, WordPress comes out of the box with a lot of things that cannot be turned off in the settings. Here are a handful of steps to take any fresh WordPress install and make it more secure and perform better:
Remove the WordPress Version
Get rid of the WordPress version number to make your site harder to be identified by hackers.\Remove Script Versions
Get rid of the version number after scripts. By default, WordPress adds
versions to all your scripts. This can lead to issues with
caching/minification plugins, as well as helps hackers identify your
site better.
Restrict WooCommerce
Did you install WooCommerce, and now the site is running slowly? Adding this function to yourfunctions.php
will prevent WooCommerce from loading its scripts on non-WooCommerce pages:Use a Function to Load Scripts and CSS
WordPress already keeps track of all the scripts and CSS that it has loaded, so instead of adding your JS and CSS into a header or footer, let WordPress handle it with itsenqueue
functionality. This way WordPress will
keep dependencies in check and you will avoid potential conflicts. You
add enqueue methods to your theme’s function.php
file: wp_enqueue_script()
or wp_enqueue_style()
, respectively.
Comments
Post a Comment