WordPress For Dummies
Doesn’t each one of us dream of creating his/her own website? portfolio? blog? whatever? I have always wanted to do so, and always was TOO lazy to create my backend and database and structure … etc. So, I thought of using WordPress and use it as a CMS to my content and blogs, well,, it went well, but of course I ran into problems and issues and struggles, and i kept searching to solve my issues, and of course used ChatGPT to solve other issues and queries. So, here, I’m giving it to you in a nutshell and how to get up and running quickly, so it will be a WordPress for dummies guide π©
Installation
Assuming you already have a an up and running server, of course you can use this link to download the source code and install it there, or, you can use the free online one on wordpress.com
- The benefit of the first option is that you will of course tie it to your own domain and have something like this https://josepham.me
- Yes, it’s written in WordPress … surprise? π
- The benefit of the second option which is wordpress.com is that you don’t need a server and it’s easy to install in one click, but you will have a free domain something like whatever.wordpress.com
How to install it on your server? well there’re a lot of ways:
- You have a linux server and you copy the source code there, install php, phpmyadmin, sql, lamp and you are good to go
- You can follow this guide:
- How To Install WordPress on Ubuntu 20.04 with a LAMP Stack | DigitalOcean
- You can download a wordpress image from the DigitalOcean MarketPlace and it will be up and running right away
- Or as we’ve mentioned earlier, you can use wordpress.com
Now for WordPress For Dummies essentials
Source Code Access
Of, so, we are developers, right? well maybe IDK π but anyways most of us are. (If you are not a developer, just go to wordpress.com and create your website there and your job here is done π unless you wanna know what we are talking about and you are interested to find out more)
So, yes, Hi Developers π. We need to access and edit our code and break things right?
How will we do that? well if you are on your linux server and already did the installation, you already have the source code and you can play with it there, but if you used wordpress.com then you will have to download and install a plugin called Advanced File Manager β WordPress plugin | WordPress.org which will allow you to access your code as if it’s a FTP or something, and you start playing from there.
Blank Template
Ok so, once we start exploring the code, we will have like 3 initial templates, if you try to explore them, you will find that they are filled with pages and files and code, we don’t need all that, right? we want something simple in order to enhance and customize it with our own way.
We can download this simple template called BlankSlate, how?
- Download it from the download button
- Move the zip file to
public_html/wp-content/themes/blankslate
- Go to Appearance Themes in your dashboard, and you should find it
- Activate it
You will find your website looks like this now:
Now we have something simple to play around with.
Classes
Ok, so as some of us may know, the main building block of wordpress is Posts as it was initially a blogging site. But what if we wanna build something other than a blog? Maybe a Cars website, and we want a Cars table.
We can create something called Custom Post Type, we can use this plugin to create it:
Custom Post Type UI β WordPress plugin | WordPress.org
And, if we want to create custom fields to it, let’s say, a Car has a Motor Power in CC, so we need a field CC, and maybe a field Color, and maybe a Brand, we need to create something called a Custom Field, and tie it with our Custom Post Type (Car), using a plugin called Advanced Custom Fields:
Advanced Custom Fields (ACF) β WordPress plugin | WordPress.org
Post Type Pages
Ok, so let’s say we have the Cars class, we need to list our cars in a page, right?
and then we will have to go to each single car page, right?
So, we need two pages to do so:
- whatever.com/cars
- whatever.com/cars/123 // car id
By default, WordPress will use the Post list and Single pages to do so, but if we want to make something custom to our new Custom Post Type (Car), we will need to create two files under our blank slate theme files.
single-car.php
archive-car.php
And make sure that it have to follow that naming convention otherwise it won’t work.
Then WordPress will start using those pages when you go to the Single or List pages of your newly created Custom Post Type.
APIs
Last but not least, APIs !!
We are here to get and post data right? so, How will we do that?
You will find a folder called plugins under: public_html/wp-content/plugins
Create a new folder and name it anything under plugins, let’s say my-plugin, then create a php file under it called anything, it will act as the main entry to the plugin, let’s say: main.php
paste that comment at the top of the page
<?php
/**
* Plugin Name: My Plugin
* Description: What do I do?
* Version: 1.0.0
* Author: Your Name
* License: GPL2 or later
*/
and then we start writing our APIs, here’s an example of w GET and POST request for a plugin
<?php
/*
Plugin Name: My Custom Plugin
Description: A custom plugin that handles GET and POST requests.
Version: 1.0
*/
// Register the endpoint for handling GET requests
add_action('init', 'my_custom_plugin_add_endpoint');
function my_custom_plugin_add_endpoint() {
add_rewrite_endpoint('my-endpoint', EP_ROOT);
}
// Handle GET requests
add_action('template_redirect', 'my_custom_plugin_handle_get_request');
function my_custom_plugin_handle_get_request() {
if (get_query_var('my-endpoint')) {
// Handle the GET request here
$query_params = $_GET;
// Do something with the query params
exit();
}
}
// Handle POST requests
add_action('rest_api_init', 'my_custom_plugin_handle_post_request');
function my_custom_plugin_handle_post_request() {
register_rest_route('my-custom-plugin/v1', '/my-endpoint', array(
'methods' => 'POST',
'callback' => 'my_custom_plugin_process_post_request',
'permission_callback' => function () {
return current_user_can('edit_posts');
}
));
}
function my_custom_plugin_process_post_request($request) {
// Post data will be in here $_POST
$body_params = $request->get_params();
// Do something with the body params
return array('success' => true);
}
Pages
And now, finally, if we want to create a custom page in WordPress.
Head to the source code in your theme and create a new file and name it anything, let’s say, about-us-page.php and paste the below comment
<?php /* Template Name: My New Page */ ?>
And then, head to Pages in your dashboard and create a new page, give it any title, and on the right, you shall find, Page Template, select the page name that your just created and wrote in the comment, in our case: My New Page, and that’s it ! your php page will load and anything you type in there will happen π
Conclusion
So, WordPress is so powerful and can make magnificent things, take this as your entry point and feel free to ask me anything further and start creating great stuff ! .. and that was WordPress for Dummies π
Here’s a potato as well.
Wonderful goods from you, man. I have understand your stuff previous to and you’re just extremely
magnificent. I really like what you have acquired here,
really like what you’re stating and the way in which you say it.
You make it enjoyable and you still take care of to keep it sensible.
I can not wait to read far more from you. This is actually a wonderful website.
Thanks !!
I am definitely bookmarking this website and sharing it with my acquaintances. You will be getting plenty of visitors to your website from me!
Thanks Kazuko ! π
I love your wp design, wherever did you obtain it through?
Thank you Alda ! π
Another interesting article, Thanks for sharing this information, it is unusual to read such high quality posts. I will bookmark your site.
Thank you Charles ! π
Thank you for sharing excellent informations. Your site is so cool. Iβm impressed by the details that you?ve on this website. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for more articles. You, my friend, ROCK! I found simply the info I already searched all over the place and just could not come across. What a perfect website.
Thank you Elwanda ! π
very nice put up, i certainly love this website, carry on it
Thanks Virgilio ! π
Took me chance to read the many feedback, however i actually loved this article. It become worth your time for me and I am particular to the entire commenters these! Itβs always good if you canβt only learn, additionally it is entertained! Iβm certain you felt the need pleasure writing this article.
Thank you Desmond ! π
Nice post. I learn something harder on diverse blogs everyday. It will always be stimulating to learn to read content off their writers and use something at their store. Iβd opt to apply certain while using the content in my small blog no matter whether you donβt mind. Natually Iβll offer you a link for your internet weblog. Appreciate your sharing.
Thank you Phebe ! π
Hiβ best wishes to you and your very nice blogβΒ Β Β
Thank you Marion ! π
Many thanks for your time to have had these things together on this web site. Emily and i also very much loved your suggestions through your own articles with certain things. I realize that you have numerous demands on your own timetable hence the fact that an individual like you took just as much time like you did to steer people really like us by this article is also highly loved.
Thanks Judson ! π
Thanks for all your work on this blog. My mother really loves managing research and itβs easy to understand why. Almost all learn all about the powerful means you deliver good items by means of your blog and therefore encourage response from others about this subject matter then my child is truly studying a lot of things. Take pleasure in the rest of the new year. You are doing a stunning job.
Thanks Alissa ! π
I couldnβt be more in agreement. By the way, do you see more of the same for the days and months ahead? I am very intrigued by your positions and your posts.
Thanks Carmela ! π
Its fantastic as your other posts : D, appreciate it for putting up.
Thank you Ezequiel !
I love reading your blog because it has very interesting topics.:.:~β
Thank you Apolonia ! π
Can I recently say what relief to find somebody who really knows what theyre talking about on the internet. You actually learn how to bring a difficulty to light and make it essential. More people must check this out and can see this side on the story. I cant think youre not more well-liked as you absolutely have the gift.
Thank you Maedke ! π
Beneficial info and excellent design you got here! I want to thank you for sharing your ideas and putting the time into the stuff you publish! Great work!
Thank you so much Breanne ! π glad you liked it
very good post, i certainly love this site, keep on it
Thank youuuu
Your blog is amazing dude, i love to visit it everyday. very nice layout and content βΒ Β Β Β
Thanks Stephania !
Magnificent website. Plenty of useful information here. Iβm sending it to a few pals ans also sharing in delicious. And obviously, thanks to your sweat!
Thank you Vincenzo
Just wanna say that this is very useful , Thanks for taking your time to write this.
thankss