Hey guys, it's Kevin again (yeah, sorry) and, if you remember, my last post was about why Wordpress doesn't suck as much as you might think, so this time I just want to expand on that subject and bring you a brief tutorial on how to setup your own project. I understand that there may be a gazillion of these tutorials online, but I want to show you how I do it and what I like to do.
First thing would be to install Wordpress. There, you're done. Thank you for reading.
Just kidding, let's get right into it.
If this is your first project I think the easiest way to start is just to download WP from the official site (at the time of this post, the latest release is version 5.6). Once you download the .zip file and extract it you can open the folder and see the following files.
If you have these files that means you correctly followed my instructions. Otherwise, I don't know what the hell you're doing.
There is another way, and the one I like the most, to create a new project, and it's using Wordpress CLI (Command Line Interface). This is a tool that let us perform actions on the console. Here is a list of all the commands you can execute. It's really easy to install, just run the following commands:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar chmod +x wp-cli.phar sudo mv wp-cli.phar /usr/local/bin/wp wp
When you type the last command you should see this.
That means you're ready to execute WP commands.
So using this tool allow us to install the necessary files really quickly. Just run the following command:
wp core download
This command has some parameters, you can see them here, but using it without any parameters should download the files on the current directory.
So now that you have the necessary files it's time to open the project in your browser and continue with the setup.
I have to make a note on this step, we know every developer has a different environment so I can't tell you exactly how to open your project on the browser. I use Laravel Valet on MacOS so for me it's a simple as going to wordpress-project.test and it opens. So if you're using XAMP, WAMP, Laragon, etc. just make sure your project is on the folder where it needs to go.
With that out of the way let's continue. When you open your project the first thing you'll see is this.
Choose you language and continue
Now on this step you have to setup a database. This is necessary to work with WP, so do it! Again everyone has a different environment so go to your favorite database management program and create a new database.
Once you create your database you need to add the following information so WP can connect to it.
Are you still with me? Good, let's continue
Once you submit the correct information, WP is going to get a little sassy on us, dont mind it and continue.
Great, so WP is connected to your database. Now for the final step. Here you need to fill in important information about your site; like the site title, username and password. By default, WP is going to fill out the password input with a very long and complicated password, which is fine, I guess. Make sure to save that information! Now for testing purposes (or if you're only going to work locally) you can change that password to a shorter one. It's a password. You've seen them before.
So once you finish that, let's install the damn thing!
If you did everything correctly then you will be prompted to the login page. Here is where you log in with the credentials you created minutes ago, which you probably already forgot. Now in case you forget your username, WP CLI can save us by creating a new user. Just run this command:
wp user create <user-login> <user-email> --role=<role> --user_pass=<password>
If you want to know what other parameters you can use, follow the documentation.
So now that you are logged in let's see what we've got.
This is the main dashboard, you can change, hide or move the cards. The more plugins you use, the more information you'll see on the dashboard.
The first thing I do when creating a new project is to make sure everything is up to date. If there are any updates for WP, you'll see a notification on the dashboard. Now on your left side panel go to plugins and make sure everything is up to date. Make sure to keep your stuff up to date, as a best practice.
Since the project is new you'll probably see only these 2 installed, but once you keep adding more you'll probably see some updates available here. Here is a very important note: if your project is in production or it's just something important, I recommend you read the update notes or do a little research and make sure it's not going to break something in your project. I had this happen before and it's not fun, so always read first.
Next step I like to do is to select a template. So if you go to Appearance → Themes on the left side menu, you'll see WP already has some themes installed. If you don't want them installed there is a parameter --skip-content on the CLI command I listed above so you can have a cleaner installation. If you want to install a theme this is the place to do it. I usually create my own theme, so if you check your project files you can go to wp-content → themes and you'll see what themes are installed and this is where you can create a new folder and setup your own theme.
This is the cleanest and easiest way to set up a project. If you go back to my [previous post](https://blog.maniak.co/post/why-wordpress-doesnt-suck-but-maybe-you-do), you can see what plugins I like to use, so make sure to read that.
I hope this was helpful and you learn something new, I appreciate you liking my content and... just kidding. I don't care.
In all seriousness, this is a series I would like to keep working on and keep giving you more tutorials and how to do, fix or break more specific things in Wordpress, so... see you next time!