WordPress Fundamentals
A comprehensive beginner's guide to WordPress
2021
By Rufus Stewart
3 nd Edition
"Programming isn't about what you know; it's about what you can figure out . - Chris Pine
Memlnc.com
Introduction 8
What is PHP? 8
the beginning 9
First steps 9
Simple example 9
If statement and conditional loops loops 9
How WordPress Blog Lists Work: 12
Functions 14
How does all this work? 15
Create snippets 16
Chapter One 19
Login page 19
Change logo: 21
Change logo link: 22
Change the login page design: 23
Finally: 26
Chapter II 26
Create WordPress user accounts programmatically 26
Create an account 27
First: User information 28
Second: Account creation 29
Conclusion 31
Chapter III 32
WordPress loop is used to format the first article in a different way 32
What you will need: 33
Let's start: Create the query 33
Add the additional query 41
Skip the first article in the main query: 41
WP_Query allows you to draw attention to your latest articles 43
Chapter IV 45
object-oriented programming 45
Before we start 45
What is Object Oriented Programming? 46
Why use Object Oriented Programming? 46
Items and Objects 51
Use the objects correctly 52
Determine the length 52
Setter Methods 52
Work with objects 53
WordPress example 55
WordPress Professional Development 56
Chapter V 57
The 10 most common mistakes made by WordPress developers 57
WordPress debugging is not enabled 57
The second common error is: Adding scripts and CSS styles via wp_head 58
The third common mistake: Avoid the use of children templates and modify the basic WordPress files 59
Common fourth error: Some values are fixed 61
Common error 5: Do not prevent your site from being indexed by search engines 62
Common sixth error: Not verifying that an extension is activated 62
Common Error VII: Loading too many resources 63
Common error 8: Keep the management bar 65
Common error 9: Do not use GetText filter 65
Common error 10: Keep the default permanent link structure 67
Conclusion 67
Introduction
If you want to become a WordPress developer, this also requires learning the famous PHP programming language, from which the WordPress platform was built. Essentially developed in 1994, PHP is a powerful, open source programming language for creating dynamic and interactive websites. You will learn the basic rules of PHP and how to write them, how they work, and see some examples.
Note: Before you start, it is important to be familiar with Html and CSS because they are essential for WordPress.
What is PHP?
PHP is a server-side scripting language. To understand what this means, to compare it with HTML. When you visit a simple Html page, your browser sends a request to the server that contains the page you are trying to access. The server detects and sends any file you want to access. Your browser translates the sent HTML code and displays it for you. By comparison, when you visit a PHP page there is an additional step your browser sends a request and the server finds the file you want. Before sending it to your browser, the server processes the file, producing a final Html output (Html output) and then sending these outputs to your browser, which displays them as usual. That's why when you look at the source code of any site you never see any PHP code, just Html, even if the site is written in PHP.
So why does the server need to process? What's the point of that? Because it enables us to create dynamic sites and write code very effectively.
Let's look at two simple examples. In HTML everything is static. You can create a page that displays the word Good morning or Good evening but you can't show one and hide the other depending on the real time of the day. In PHP you can do this because the server can process the code taking into account the real time of day. The logic for this example is as follows:
if it is before 10am {
Good Morning
}
if it is after 6pm {
Good Evening
}
otherwise {
Good Day
}
Of course this is not real code, but it follows the PHP logic. The server will determine which status is true for the condition and will display only one of the addresses. Another example is Twitter or any other site that offers content written by users. If Twitter only uses Html, someone has to put your tweet in the Html file each time you post a new tweet and this is of course not a good time-taker. There are about 1 billion accounts on Twitter so the company will need 1 billion Html files, one for each user. With PHP, the problem of regenerating what the user publishes can solve several files. We will return to this example later in this article.
the beginning
Before we get started, I'd like to note that in the early stages of learning PHP you probably won't be able to create a website. This is a natural reaction and this is also what I felt when I first started learning PHP. The first steps are a little abstract, but at the end of this article you will see the light. In order to test and practice what you will learn in this article, you will need an Apache server. This can be an online test site, but it can also be a local server. I recommend creating a local server. Here's how:
First, download and install Virtualbox and Vagrant. Create a path anywhere on your computer to store project files. I have a websites folder in my user path, I created a PHPtutorial path. I will refer to this as the main project folder throughout the rest of this article.
Once the path is created, open terminal on linux or osx, or cmd on windows, and navigate to the folder. If you create the same folder structure as I have, on linux or osx you can type
cd ~ / websites / PHPtutorial
On windows
cd% HOMEPATH% / websites / PHPtutorial
When in the correct path, paste the following command:
curl -L -o -o 'install.sh' http://bit.ly/1hBfq57 && curl -L -o 'Vagrantfile' http://bit.ly/1mE3Qt9 && vagrant up
Once the order is executed, you will be able to access your site at http://192.168.33.21. If you restart your computer, you will also need to restart your server, which you can do by going to the main project folder in the command line and typing vagrant up. The main project file is now your root folder. Create an index.html file there with no content and should be displayed correctly when you visit your website at http://192.168.33.21 .
First steps
First, let's look at tags, variables, values, and echoing. Create a file named index.php in the main project file and type Hello HTML inside it. To make sure it works, visit http://192.168.33.21, and you should see the text you typed on your browser screen. A very important rule is that what is written inside the php tags is PHP code, and anything else is HTML. So Hello HTML text appears. Php tags start with Php and end with?>. Anything between these two tags is considered PHP.
Hello HTML
PHP echo "Hello PHP"; ?>
The previous code showed how to use php tags and how to show values on the screen. When you show a value, you tell PHP to display this value on the screen. The result of executing the preceding code will be Hello Html Hello PHP. The first part is considered Html because it was not inside PHP tags while the second part was shown by PHP code. Note that the text must be enclosed in quotation marks. Variables allow you to store values without displaying them. Variables are frequently used to store many things. Let's take a look at a simple example: