Out-of-the-Box WordPress: Bundling With Themes & Plugins and wp-config Tweaks
Ten years after the first release of WordPress, the installation process is still kind of… boring. Move the core WordPress files, install WordPress, then install plugins and themes, switch themes… Is there quicker way to install WordPress?
Well, there is.
Warning: This is a tutorial for all levels of WordPress users, but I kept the tutorial short to be compatible with most hosting environments. I know that we can install WordPress way faster with varying techniques, but this tutorial will tell you how to create an out-of-the-box WordPress installation that can be installed on a shared hosting environment. Be that as it may, I’ll be delighted if you shoot a comment below in the Comments section and share more techniques that can be used in “better” environments. Be sure to specify the environment that should be arranged, though.
Creating a Ready-to-Install WordPress Package
We, as human beings, are lazy. We weren’t always like this, but when the communication speed came close to the speed of light, we became lazier and more impatient. Because of this laziness, we want everything as soon as possible—right after we want it, if possible. (We want it all, and we want it now!) We want speed so bad that we actually started wiring our brains that way. That’s why our attention span has shortened and automatization has been equated to efficiency.
But this doesn’t necessarily have to be a bad thing. We really need automatization and we really need some (incoming hype word!) zen in our lives. And in terms of web design, it’s always better to finish the project fast because then we might get our money earlier.
This two-part series might get you your money earlier. With these tutorials, you’re going to learn about:
- bundling your WordPress installation with themes and plugins of your choice
- utilizing the
wp-config-sample.phpfile to define constants earlier than usual
- and ***REDACTED TO KEEP THE HYPE*** which will blow your mind!
Bundling Your Installation With Themes and Plugins
This one’s kind of obvious, so I’ll keep it short and move on to the
As of 2015, WordPress comes with the “Twenty Ten”, “Twenty Eleven”, “Twenty Twelve”, “Twenty Thirteen”, “Twenty Fourteen”, and “Twenty Fifteen” themes. I like some of them but I really really dislike “Twenty Thirteen” and “Twenty Fourteen”. I totally like “Twenty Fifteen” though. But still, I don’t use any of them at all and use my own “theme boilerplate”.
So it’s sensible to get rid of all the “default themes” before installing WordPress. We normally encounter a “default theme not found” error because WordPress sets a “default theme” inside its core and doesn’t let you change that—or does it? Stay tuned for the awesome second part of this series!
The same goes for the default plugins. “Hello Dolly” is a fun plugin to see how plugins work for WordPress beginners, and “Akismet” is an effective solution for WordPress comment spam. But if you’re not a WordPress beginner and don’t use the “comments” feature in your projects (or use an external comments service like Disqus or Facebook Comments), you don’t need either of those plugins. So why keep it in the installation file and clutter it up?
Instead, you can ship with your favorite plugins (or your own plugins). In this series, we’re going to use three popular WordPress plugins:
We’re not going to use them in this part, but you’ll see them in the next part.
Little tip for cPanel users: In cPanel, there’s a feature called “skeleton directory”, which allows you to create cPanel accounts with files inside the
/home/ directory. I, personally, like to use this feature to create a
/wp/ folder in the
/public_html/ directory in the hosting account that I use for my clients. It contains the core WordPress files, a “theme boilerplate” that I made, and plugins that I use in almost every project that I begin to make. (I also delete the default plugins and themes, and edit the
wp-config-sample.php file—I’m going to talk about that in the next section.) If you have cPanel as the hosting control panel in your server, locate the
/cpanel3-skel/ directory in the root (or ask your server administrator where it is) and move the files there to create hosting accounts with WordPress files already inside it. If you don’t have cPanel in your server, ask the server administrator if there’s a way to make this functionality work with your server.
Editing the wp-config-sample.php File
Here’s a fun fact that will blow your mind: Most of the changes in the
wp-config-sample.php file are automatically applied to the
wp-config.php file during the installation. (If I’m not mistaken, database credentials and salt keys in
wp-config-sample.php don’t migrate to
wp-config.php.) This was a tip I shared on Tuts+ about a year ago; and back then, this information couldn’t be found anywhere on the internet—not even in WordPress Codex. So, ahem, I was the first one to share this tip in the world. (Foreshadowing: In the next part, I will share another trick that’s never been discovered by another WordPress developer!)
Anyway, back to this part: Just edit the
wp-config-sample.php file in your package which you’ll be using in your future projects. I put together some custom constant definitions that can be applied for client projects:
<?php // disable revisions define( 'WP_POST_REVISIONS', false ); // autosave interval define( 'AUTOSAVE_INTERVAL', 240 ); // the value should be in seconds // disable editing theme/plugin files from wp-admin define( 'DISALLOW_FILE_EDIT', true ); // enabling "trash" for media items define( 'MEDIA_TRASH', true ); // moving wp-content define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/stuff' ); define( 'WP_CONTENT_URL', 'http://exam.pl/stuff' ); // moving uploads define( 'UPLOADS', 'files' ); // change "emtpy trash" settings define( 'EMPTY_TRASH_DAYS', 10 ); // 10 days define( 'EMPTY_TRASH_DAYS', 0 ); // disable trash ?>
These are the things that came to my mind. Do you have different ideas? Share them in the Comments section!
On to Part Two
While the things I’ve written above are already very cool tricks that will speed up your installation process, the “hack” in the next article is even cooler. You probably feel my excitement in my words but I’ll say it again: I’m extremely excited that I will reveal a groundbreaking technique that’s going to be published first and only on Tuts+ Code!
What do you think about the tricks that we went over above? Shoot us a comment in the Comments section below, if you want to share your thoughts with us. And be sure to share this article with your friends!