Learn PHP Basics for WordPress | Alexander Oni | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

12 Lessons (1h 16m)
    • 1. WordPress for PHP Promo

      1:35
    • 2. First things

      3:15
    • 3. What is PHP

      6:19
    • 4. Writing PHP Code Properly

      7:29
    • 5. PHP in WordPress

      11:02
    • 6. Combining HTML and PHP

      4:09
    • 7. Working with Conditional Tags

      9:43
    • 8. WordPress Functions

      7:05
    • 9. Actions and Filters

      13:17
    • 10. Variables and Arrays

      6:49
    • 11. The WordPress Loop Re

      4:22
    • 12. PHP for WordPress Conclusion

      0:36
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

100

Students

--

Projects

About This Class

Welcome to the PHP basics for WordPress course.

This is a beginners course designed for WordPress students who would like to become WordPress developers.

WordPress as a content management system was built with PHP and its most important files as well as those of plugins and themes are coded with the scripting language. As such if you aspire to be a WordPress developer then you must learn the basics of PHP which is exactly what this course provides.

In this course you will learn the following

  • What exactly PHP is

  • How PHP is used in databases

  • How to write PHP code properly

  • How to combine PHP and HTML in the same file

  • How to write basic WordPress functions using PHP

  • How WordPress template tags work

  • How WordPress Actions and Filters work

  • How to work with conditional tags and statements

  • How to work with variables and arrays

  • How the WordPress loop works

In addition to the above, you will also learn about some of the most important files used by WordPress themes.

Please note that this course is NOT a complete course on PHP but a basic introductory course designed to provide you with just the basic knowledge necessary to start learning about WordPress development.

By the end of this course you would have learned the basics of PHP which would help you progress to learning about WordPress development.

Meet Your Teacher

Teacher Profile Image

Alexander Oni

Web Developer & Cyber Security Expert

Teacher


My passion is teaching people through online courses in a fun and entertaining manner.  I have been teaching online for about 3 years now and during this period, I have created over 25 different courses on different platforms including my own personal platform - The Web Monkey Academy.

What would you like to learn?

Would you like to learn how to build and manage your WordPress website? Would you like to learn advanced skills that will make you a true WordPress developer? Would you like to learn how you can establish a successful career as a web developer? Would you like to learn the basics of information and cyber security?

 If you want to do any of these things, just enroll in the course. I'm always improving my courses so that they stay up to dat... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. WordPress for PHP Promo: Well, hello there and welcome to my various special course, a land PHP for WordPress. And this is a course designed specifically for students who are wordpress users want to become WordPress developers. Now it is essential to learn PHP because PHP was actually used to build what press. As such, if you're going to become a WordPress developer, developing your own themes, plugins and functions. It is essential that you learn at least the basics of PHP, and that's exactly what this course is going to offer you. So in this course we're going to take a look at PHP, what exactly PHP is and how it's different from other programming languages. I will show you how you can write PHP code properly and also how you can combine our HTML code with PHP. And then we'll move on to the main section of the course where I'll show you how you can begin to write your own functions, you on workers functions using PHP. I'll show you how to walk with conditional statements such as the if-else statement. I'll introduce you to Hooke's actions and filters, which are what those functions. We'll also talk about variables and arrays. And finally, I'll talk to you about the single most important function in all of WordPress, which is the WordPress loop. So by the end of this course, you will have gained the basic fundamentals of PHP and how you could use PHP to become a WordPress developer. So if you feel that this course is going to be ideal for you, I'll include you to center for the course today and I hope to see you on the inside chairs. 2. First things: Before we get officially started with the cause, there are a few things I want to mention and clarify. First of all, this is purely a basic introductory course to PHP. It is not going to be an intermediate level or an advanced level or anything like that. This is purely for beginner. So if you're new to page B, this course is going to be perfect for you. Our second, for what purpose? Ideally, you should be an intermediate level user of what quiz you can be a complete beginner, you need to have an intermediate level knowledge of what cues you should be comfortable working with WordPress in order to take this course. There are two main websites we will be using. One is PHP.net, which is the main official website for PHP. Second would be the WordPress codecs, which is the main repository for all functions and anything pertinent to what development. So you can bookmark this two pages. Now, if you're working locally on your computer or on your Mac, you don't need FTP axis, you're fine. However, if we're trying to walk on a website that's live on the internet. You're going to need FTP access because we are going to be walking with our theme files. We will be using the WordPress 2021 theme by the way, the official 2021 thin. So in order to access the theme files on the server, we are going to need FTP access. If you don't know how to create an FTP account or how to get FTP access. I do have a full tutorial on YouTube showing you how you can do that. Now I'm also going to be using Notepad Plus Plus as my text editable, gonna make changes to our files and then upload them back. So I will be the Notepad Plus Plus for that. Again, I do have a full tutorial here on YouTube showing you how you can work with Notepad Plus, Plus. But if you have another text editor you're working with, maybe like Sublime for example, you don't have to use Notepad Plus, Plus. It is not compulsory at all. And then last but not least, I do have a full course about WordPress theme development. It's available on the Web Monkey academy.com. It's also available on Udemy. In fact, my main purpose of making this short free course is to introduce you to what does development. And then in the hopes that if you're convinced that Hey, I really want to become a corpus, then develop up. You can then sign up for the more advanced course that goes a lot deeper into what Press theme development so you can check it out if you're interested. And then there is one thing I forgot to mention as I was making the course, and that's because I took it for granted and I don't want to take anything for granted. Okay. Php files, you end them with dot PHP for example, right here. Because all these files right now for, for the PHP archive, that PHP for little PHP and so on. There's our PHP file. So you end your files or PDF files with dot PHP. And finally, you open up a PHP code with the less than symbol question mark and then PHP. So right now this would be the opening of any PHP statement. And then down here where you have the question magnetic good at and symbol. That's when you're closing the PHP code. So you have to open up your PHP code and enclose it. So avoid any thin gouache. And so I forgot to mention this during the course and it was only when I was going through the videos I realized, oh, I forgot to mention this very, very single factor. It's important that I need to mention it because it's something people can take for granted. So that's it. I hope you enjoyed the course. Let's now get started officially with the Olin PHP for workers course. 3. What is PHP: Okay, so let's start by talking about what PHP actually is and what it does. And PHP stands for the Hypertext Preprocessor. And what it does is that it actually retrieves data from a database. So basically it is a server-side scripting language, and that's what separates PHP from other languages like say JavaScript. Most other languages will do the job on your computer or on your browser. But PHP does its job on the server side. So if you're trying to access data from a server, maybe it's a web server or database server. You would use PHP if you're trying to send information or data to a server. Php will also be involved. Now I would highly encourage you to bookmark this particular website. It's called PHP.net. And it's the main website for everything related to PHP. You can take a look at the documentation and a lot more information there about PHP. So how does PHP actually interact with WordPress? What's the relationship? I don't know if you've noticed this before, but whenever you install WordPress, typically you would also create a database as well. It depends on how you install, what personal watts hosting panel you use. But in my case, I use our SiteGround and when I try installing WordPress front-end, back-end, I always have the opportunity to name the database table and do things like that. So when you install WordPress, you're also creating a database as well. Now it isn't your database where most of your files are stored in your pages, your posts, your user data, passwords, all those kind of information is stored in your database. Now I'm gonna give you a live example in here. I do have one of my demo websites. The movie characters.com is just a sample blog with some sample post and things like that. Now I'm over here on site ground, the backend for site. And you can see I do have the website movie characters.com. Now I've accessed the database, and this is the database right here. The name is America 61 it on a score WPA3 to nine. Okay. I'm going to expand the database and by now you can see I have access to different kinds of tables. And even from the name, you can kind of tell what they're about. Down here as an example, you can see I have the all the way down here. Okay. Oh, I'm sorry. It was right up here. Okay. Wp underscore posts, right. You said this table. I did. I'm going to open it and I'm going to show you some stuff. If I go over to my website right here, you can see I have posed to a letter to movies and games, tightened Fall Review. You can see I have a kangaroo box at your light hits the web. Login makes 900. I have tags like action are terminated too. I do have a post about Terminator 2 as an example. If I was to go to my database right now, can you see the post titles in here? You have box office numbers rise in Terminator to review a quiet place we view. There's another one here, two minute or two on its own, and so on. So right now you can begin to see the titles of the poster that have, you can see the postdates, the actual post content itself. And then if I scroll over here to the writing in c or the information like the published status, whether it's published or in draft mode, the common status with our comments are allowed or not. If the post has a password that you need to use in order to access the post, the post name and so on and so forth, post modified and a lot more information. So right now you can see that all of this information is on the database. If I go back to my database and I opened up another table. Just to give you another example down here, uses WP underscore users that should tell you that this table contains the user information, people who have accounts on the website. So right now you can say, do you have to login IDs, movie and developer. You can see the emails and you can also see some other information about the particular user accounts. So the whole point here is that whenever I tried to do something on my website or anybody tries to do something on a website. So for example, they clicked on Bruce Willis words for the fifth time in order for workers to be able to display this post, display the featured image, the Type tool, the content, and so on. It has to go to my database and pull the information from there using PHP. Now how, what person knows what content belongs to, what post is through the ID. All your posts have IDs. I'm not sure the post ID for this particular post, but check this out. We can actually find out if I was to go back to the posts table. And I searched for Bruce Willis where it's for the ninth time. Let me scroll down here and see. Okay, It's down here. You can see the ID is actually 59. So when I click on the link for that post, wordpress knows that, Oh, the idea for this post is 59. Let me go to the databases in PHP and search for the content for the post with the ID of 59. That's basically the relationship between PHP and WordPress. So once again, PHP is used primarily to pull information or send information to a server. It's server-side scripting language. It does its job on the server side. And that's what separates it from other languages like JavaScript, most other languages will do their job on your browser. Php does its job on the server side. So in the next video, I'm gonna show you a lot more about the relationship between PHP and what present, how our PHP is actually used to create different kinds of functions in WordPress. 4. Writing PHP Code Properly: Let's now talk about how to write PHP code properly. In other words, we're talking about PHP code in standards. And I do have quite a list in front of me. So let's get started. The first thing we're going to talk about would be how to name your functions and your variables. And in here we have a classic example. We have the function 2021 or widgets on the score in it. The job of this function is to register a sidebar. But notice that the actual name of the function is widgets on the score in it. But they start of first by same function. So we have function and then you want to add a prefix before the name. The prefix in this case it's a 20, 21. And the reason why you want to add prefixes to your function names is because there could be another plugin somewhere on the website that uses the same function. And if both your theme and your plug in r using the exact same name for the function, you could end up having a conflict. So to avoid that is best you just use your own unique prefix. It could be the name of your theme. It could be your own name, it could be anything. Just have a prefix before the actual function name. Next would be the use of dashes and underscores. When do you use them? Typically, you would use your underscores whenever your name in your functions are your variables, in this case it now but the prefix, we have 20 underscore, 20 underscore, one underscore widgets underscore in it. So you'd use underscores to separate words whenever you're naming your variables or your functions, you would use dashes when you're trying to add a CSS class in this case right now, down here you can see it says H2 classic calls, we did dash title. So when you're adding classes or ideas, you would use the dash. You would also use the dash whenever you're naming your files. In here in the content folder, you can see we have files called content dash excerpt, content, National, Content page, content dash, single. That's when you would use it. Dashes. Don't worry, as you work more with PHP, you'll get used to when to use the underscore and when to use the dash. All right, Next, it would be the use of single quotes and double quotes. Now, right here, I have an example where basically echoing a statement, I am sorry, this is the header of the page. Now, one way I could, I could be vide, this would be to simply say, I'm sorry. This is the header of the page, okay? However, in most cases, you would typically use the single quotes. Single quotes are used a lot more often than double quotes. Now, this is the ideal way you divide this kind of code, echo single quote and then the HTML code, I am sorry, this is the head of the head of the page. But what if you wanted to use the short form of IM? So right now I say, I am without the a. You can't have a single quote inside of another single quote, it will break the entire code. So what you could do in this case right now would be to wrap the single quotes inside of double quotes. So right now, you can see that, sorry about that. Right now you can see I am using the double-quotes true up the single quote inside of it. Now the code would work. You can't have a single quote inside of another single quote and you can have it double quotes inside of another double-quotes. In most cases, the double-quotes are actually inside of the single quotes. The reason why is the reverse where you have the single quotes inside of double quotes because this is English. When you write, I am sorry, you don't use double quotes. You typically would use the single quotes. However, you've also got to my functions.php right here. Notice we're adding the title. The H2 class II calls with a dash title. The name of the title isn't double-quotes, while the actual HTML code is wrapped in single quotes. So once again, you can have single quotes instead of single quotes. You can have double quotes instead of double-quotes. And in most cases the double quotes would be inside of the single quote. You would only use a single quote inside of a double-quotes. When you're trying to light sentences like this in English, I'm sorry, I didn't shouldn't, stuff like that. Okay. Next would be the closing PHP tag. Now, in most cases, when you open up your PHP tag, you should close it right? However, don't be surprised that you may see some files where all this is the opening PHP tag, but you never see a closing PHP tag. Here. For example, in the page that PHP we have the opening PHP tag, but there is no closing PHP tag ID. That's because there is no need to do so. In fact, page-based is one language way. You can open it up, add code, add code, add code, and you never have to close the PHP tag. You can only close the PHP tag if within that block of code you want to add coal from another language and be like HTML or JavaScript. In this case, right now, everything in here is pure PHP code. There is no HTML, there is no JavaScript. In fact, if you go to your functions.php file, at the very end, maybe some things might not do this, but the vast majority of them's a function that PATRIC file. You will never see the closing tag. Now. It's just going to be empty. Now this was the opening PHP tag right up here. And you can see right now that we've had, we've had several functions as a function right here. There's another function of idea. All do another function, another function all the way down until we wanted to add a JavaScript code. That's why we closed, that, opened in PHP tag right there. We added our JavaScript code. Once that was close to me, then open up the PHP tag again, until down here once again. So in most cases it's safer to just open and close your PHP tags. Okay, but don't be surprised if you do C files where there is no closing tag. Okay, the last two would be identification and comments. If you've worked with HTML code before, your CSS code, the already familiar with these concepts, make sure your code is, is well indented so that it's very, very easy to lead. As an example right there you can see this function to register the sidebar. You can see how it's all indented. I know that this right here, this is a block of code for registering it sidebar and then divide here for example, you can see how you have the main area up here, and then inside of the arrow, you have the child areas with all the properties and values. You can see how everything is laid out properly. So keep that in mind and then let's talk about the communists. How do you add comments in PHP? Comments, I agree to add commentary to describe what a function is doing. So the ideal way would be to have the forward slash and then your asterix, and then you have a comment. And then to close the comment, you would have your asterix and then the forward slash again like inherent example. Okay, that's how typically you would write your comments. You don't need to use the single asterix symbol before the actual comments. It's not necessary, but a lot of what, what producers prefer to do it that way. So if want to stick to the original standards by honest, you can do that. So that's pretty much it. There are still a few other coding standards that you will come across, but these are the most important ones that I've covered so far. So hope you enjoyed the video and I will see you in the next one. 5. PHP in WordPress: So now let's talk a little bit more about how PHP is used in WordPress. Now I've switched things up a little bit. I do have another website in here, another sample website. And right here I'm just quickly show you. I do have one post and it's titled PHP for WordPress. And it's a typical WordPress post with a tie tool featured image and some content. Okay, and then down here you can see we have the category of depth tutorial and some other information. Let's go back to the backend. I also have a page called Recipes. Let's view the page and thus the page right there. Okay, I am using the default WordPress 2021 theme. By the way. Now, I'm going to go over to my text editor in hand, Notepad Plus, Plus, but I'm connected via FTP to my 2021 theme. And you can see we've got the files right here. And the first file I have opened in here is the function's dot PHP file. This is basically where the vast majority of the functions used in your theme are located. Navy. Scroll down in here. You'll begin to see different kinds of things like a way. You'll see names of functions. You will see if being used a lot, if else, while, all these are PHP, OK, you can see down here are way, way, way. In here we have another function. If it's customized, preview, do something. Right here. You do have the function for creating and administering a sidebar. You can see right here it says Register sidebar. And then the R way basically has different kinds of information about our sidebar, like the name, the ID, the description, and so on. Okay, let's move on. You now have the index.php and this is easily quite possibly the single most important file on, in any WordPress website and any WordPress theme. There hasn't been that this is typically the main template file that wordpress uses to display content on a page. Now what preschool use this particular file if there is no if there isn't any other file that is higher in the template hierarchy. What I'm trying to say here is that how does what players know how to display contents of a page, and then how to display contents for a post. Those are two different post types, right? Well here's the thing. You do have a file or a template file here called page dot PHP. This is typically used for displaying pages. Okay, now to prove it to you, I'm going to do something right here, okay, right here at the very, very top. I'm going to say this is a page. And I'm going to save this change. Note, I'm saving it into page dot PHP file. Now if I was to go back to my websites, this right here is a post. Remember PATRIC for presupposed. If I refresh the page, if I refresh this post, you can see right now we don't see the this is a page statement, right? But if I was to go to my back-end and I viewed the Recipes page. Let's view the page right here. You can see right now it says this is a page. That's because what twists using the template hierarchy knows that, okay, this is a page. It checks to see. Is there a file called pages of PHP? Oh, there is a file called pips that PHP, let me now use that template to display the contents of the page. And because I went to my file right here and edit this is the page what pays outputs. This is a page. Okay, so going back to the whole template hierarchy, thin. If page dot PHP did not exist in my theme, lot quiz will use index.php. It's kinda like the fallback option. It's always the fallback option whether you are displaying posts, pages or even content from other custom post types. Index.php is always the last option if there isn't any more specific file. Now you've seen page dot PHP displaying content for pages, right? Let me, let me remove this comment right here real quick. Let's cut that out. Let me remove my space. Let me save this. Now, the file that has been used to display contents for my posts is the contents dash single dot PHP template file. Now right here, I'm going to do the exact same thing. I'm going to paste the same continent and I'll say this is a post. Let's save this. And as you can imagine, I'm gonna go back to the back-end right here. Now I'm going to refresh my page. You can see nothing is showing up. But if I was to go to my post right here and I refresh the page or the posts rather, you will see that that did not display. Let me go back and see what happened. This is a post. Okay. And I'm just make a quick change once again, not quite sure what happened there. Okay. So it definitely saved right now. So if I was to go back and I refresh, I think it should be down here actually. It should be around here. Oh, this is This isn't the main I'm sorry. I'm an idiot. This is the homepage. This isn't actually the actual post page itself. This is the homepage of the website. So if I was, let's now go to page 34 because the actual page itself now you can see it says this is a post. I'm sorry, I do lose my train of thought going on with coordinates, not easy. So you can see it says this is opposed specifically fall. This was right here. Okay. That was close. I'm going to go back and I'm going to remove this. Okay? And once again, what pieces, of course, using PHP to pull in all this information. Now there is something else that you should be aware of when it comes to PHP and WordPress, there's this thing called template tags. Template tags are kinda like pre-built PHP functions that are used to display setting kinds of information. One of the best examples I can give you is right here in this template file, the content that single dot PHP. So here's the thing. What Chris is, this plane. And just refresh this page. What price is explained, the title of my posts, right? It's this plane, the featured image. It will display the content. And then down here it's even displaying the published date, the author, and even the category of the post. How does what British know how to do this? That's because of something known as the template tags. The template tags are pre-built functions that display setting kinds of content dynamically. I'm going to prove it to you. If I was to go back to the template file right here for our posts. Do you see this time I take hold the title PHP, the underscore title. This right here is a template tag used specifically for displaying the title of our posts. That's why we have the title showing up. It also go right here, right now and I remove this, Let's just cut it out. And I save. If I was to go back to my post and I refresh, you can see right now the title is no longer there, it's gone. That's because we moved a template tag. Let me go back. And I will undo what I did. Let's add another template tag right here. We're going to display the category of the post just beneath the title. And how can I do that? I can make use of another type known as the category. It really is there straightforward. So if also go out here and I changed the title to the category, and I saved. Okay, I'm gonna go back to the post file right here refers to a page. And right now you can't say we had a category div tutorial. That's basically what template tags are. There are many, many, many template tags and in fact, they should have opened up a page to show you what the different WordPress template tags are. And I've opened them up and I didn't wanna do it live because my Internet here is pretty, pretty bad. So I had to pause the video, open up the page, and here it is. So if you go to codecs or wordpress.org forward slash templates underscore tags right here you can see so many of them. You have the general tags, get header, get FUTA. Let me show you those by the way, if I was to go back right here and I go to page dot PHP, actually it was good to index dot PHP. This is the main template file right here, I'm sorry, not index.php pages of the page we listed repeatedly PHP. You can see right here it says get header and get header. And then down here it also says get FUTA. These are functions that pull in the header of the website and also the FUTA of the website. Now if you look over here to divide in my theme folder, I do have the file called header dot PHP. It's a file, right. Did you specifically for displaying contents in the header which would typically be a logo, as well as your main menu. Now if I was to go up here, and I do the same thing and I said, this is the header. And I save this file. As you can imagine, if I was to go back to my page. Now because the header is global, the header is on every page and every post. If I refresh this page right now, you can see it right up there. It says this is the head up. If I was to go to my post and I refresh, it's also says this is the header, and so on. Now likewise, you also have the exact same thing for the FUTA dot PHP as well. So these are functions that will pull in pages. Header dot PHP, Frodo, PHP. You will come across them more as we progress. Okay, Let's go back to the template tags in here. So you have other ones like get the side bar are the login form, archives, author information category information comment tags, and so on and so forth in modern welcome to spend time going through all these tags are if you wanted to. But that's basically it for WordPress and PHP. Again, as you progress in this course, you'll begin to understand more of the relationship between PHP and what quiz, hope you enjoyed video, I'll see you the next one. 6. Combining HTML and PHP: Now before we begin why it's improper PHP code, I want to quickly cover one very important topic, and that is how to combine HTML and PHP in the exact same file. Now I'm going to use the type tool template tag as an example. Let's say we want to display the title of a post, but using the H1 tags from HTML, the easiest way would just be to open up the H1 tag, first of all. And now open up PHP and say v underscore title. Close it up, and now close the H1 tag. All right, I'm gonna go ahead and save this. And let me come back in here, refresh my page. And there is PHP forward press, very, very straightforward. Them walk you through what I did. So the whole point here is that we want to display the title in the H1 format. So we open up HTML, first of all, with the H1 tag. Now we open up PHP at the template tag, the title, then closed it, dummy close the H1 tag and that's exactly what we got. This by far, is the easiest, most straightforward way of combining HTML and PHP. Whenever possible, make sure you have your PHP code inside of your HTML code. It's very, very straightforward and it's the easiest form of syntax to walk with. We could do the reverse. You have the HTML code inside of the PHP code, but then you would use echo or points which are functions on the PHP. Well, in all honesty, I did want to cover that because it gets a little bit tricky and it can be very, very messy. However, there are certain situations where you can't avoid having a decimal code inside of PHP code. Now I've actually created a function in here to show you what I'm talking about. And I'm going to walk you through what is going on in here. All right. Let me just first of all, in densities properly, okay. So the whole point here is that we want to display the text. You're very, very much, you're very welcome. But using the p tags actually, let me change it to one, just so we have some consistency. All right. So we want to display your very welcome, but in an electronic format, but it's going to be with the use of a function right here. Let us go ahead and save this. First of all, just to confirm that it actually works. So let me go back in here, refresh the page, and there it is. You're very welcome. Okay, let's go back to the code right now. What's going on in here? I've created a function called print greeting. It's PHP, so I have my opened PHP tag by DAY function and then the name of the function. Now, because we intend to introduce it SAML code, we have to indicate that Hey, HTML code is coming up next. That's where this opening curly brace comes in. It's the signal Coming up next is going to be HTML code. However, because we need to close the PHP tag before we can introduce the HTML code. That's why we had to close it by eight here. You can see we've closed the PHP tag, but because of this curly brace, the function knows that hey, coming up next is going to be HTML code. That is the HTML code right there. And now because we have the opening curly brace, we need to close it. And because we've already ended PHP, because we had to introduce our HTML tag. We have to open up PHP again. Now close the curly brace, we have the closing curly brace. And now finally close the function. And then down here, we simply call the function of all we will cover functions more later on in the course, so don't worry about that, but that's basically one scenario where you will have a similar code inside of your PHP code and you have to use the curly brace and the closing of quizzes to include HTML. Or within PHP, there are so many other situations where you will have HTML and PHP are being combined, but these two are the usual, two most common. So that's it. Thank you for watching and I'll see you in the next class. 7. Working with Conditional Tags: All right, so let's first of all take a look at the conditional statements with PHP. And as a WordPress developer, you will come across conditional statements every time. The very, very, very common. And I thought that it will be best before we talk about functions to actually talk about the else, if and conditional statements. So right here in PHP, I do have the documentation pulled up and he gets it right now it's very, very simple, very easy to understand conditional statements basically just check to see if one condition has been met. And then if that condition has been met, do something. Otherwise. If the condition was not meant, then you can do something else. In this case right here you can see a very simple example. You have two variables, a and B. And we've said the very first condition, if a is greater than b, if a is greater than b, then echo, say a is bigger than b. And now we're saying else if betweens went up providing a second condition, if a developer of a is equal to the value of b, then echo a is equal to b. And then the third condition, else, if this first two are not met, which means that if the value of a is not greater than b, and if the value of a is not equal to develop bead and obviously the value of b should be greater than the value of a. So echo a is smaller than be. Very, very, very simple to understand element of stress right now that you don't need to have an else if statement, you can just run one single condition. If this is this, then do this. You don't have to set the alternative for, okay, Well, what if the first condition was not met? What should PHP Watcher, what price do if you don't sit that, then WordPress will simply not do anything. So I'm going to give you some examples in head of a cleaner form. What to us? We do have something called the conditional tags. These are texts that we could about what Chris already that helped to check if setting conditions have been met, sold, and does give you a few of them lightly, you can see it checks to see if it's the homepage. If we're on the front page, you scroll down. You check to see if it's an admin. I'll scroll down a bit more. It checks to see if a post is sticky, if comments are active and so on. You can check for so many different kinds of conditions. If a particular page is in a category with the ID number nine, and so on. Like I'll encourage you to take a look at the page because you have so many conditions, however, I want to give you an example and the conditional tag we're going to walk with is the has post thumbnail. This checks to see if a post has a featured image attached to eat. Now over here, for my post, I do have and image right here, we can see the PHP featured image. Now what I'm gonna do is I'm going to create a conditional function that will check to see if my post has a featured image. And if it does, we're going to change the size with which the image is actually displayed. Now, if I was to go to my notepad file in here and I go to content that single dot PHP with the 2021 season. We do have this function in here called the 2021 posts thumbnail. This is the function currently displaying my featured image and my post. However, we're going to change it again. I'm going to go ahead now to remove this function. Okay, now if I save this, if we go back to the post and I refresh right here. You can see right now the featured image is no longer shrink because I have to move the function. Cool. Let me now go ahead and grab this function I wrote earlier. Let me copy that. Let's now go back to my notepad file. And right here, right here, I'm gonna go ahead now and paste this. And what do we have here? Check this out. I have created my conditional statement in my conditional function in here that sees if. And now the actual conditional tag has post thumbnail. So first of all, I'm checking to see if my post has a thumbnail. Then this splay the thumbnail, this condition, this, this template like write a v underscore post. Thumbnail, is what is used to display the featured image of your posts, just like the underscore title is used to display the title, the underscore except is used to display the excerpt. The underscore post underscore thumbnail is the template tag pre-built and what person I will display your featured image. Now, the post underscore thumbnail template tag can accept the size of the image that we want to use. In this case, right now, I have set the size to medium. So now I'm telling what is that? Hey, if my post has a featured image, display the featured image, but with the size medium, I'm going to go ahead and save this. And if we go back to my website, refresh the page. Now you can see we have the image being displayed in the medium size. Now please keep in mind that by the size, we're not necessarily talking about how large the image is going to be. The reason why is because we did twenty one, twenty two, twenty one theme. It has been designed in such a way that the featured image is going to occupy a certain width and heights are search. This size with which we're displaying the image will determine how clever or how blurred the image is going to be. Now because we're displaying the image with the medium size of 300 pixels by 200 pixels, which is the default with what was, what was is now going to stretch the image to occupy the initial width and height that has been said by the theme. That's why it's looking very, very blurred. But guess what? If a go back in here and I change medium to an even smaller size which is thumbnail, which I believe is 150 by 150. That's usually the default. I think I misspelled thumbnail, thumbnail, not Mill. Let me save that again. And if I go back, check this out again, I'm going to refresh the page. And now can you see it's even a lot more blurred now it's even a lot hollow right now because of basically forced to Wordpress to stretch the image. That's where Zukin all very, very blurred right now, but that's what the whole point of this video, the point here is just to show you that we're actually able to change the size of the image. Now if I go back in here and I change this now from thumbnail to large. Okay, now the image is going to be a lot clearer because discipline it's using the large size, they're very refresh. Now you can see that the image is now very, very clear because we're no longer stretchy and it's really use of the medium size or the thumbnail size. So that's basically a conditional statement right there. You will come across them in so many situations. And going back to my file right here, like even in the header dot PHP, actually you don't have any of conditional statements in there. If I come down here to my single micron, other single PDF file, right now you can see one conditional statement in here that says IF and then is not singular. Notice you have this sign right there. Okay? This right here is the knots not value. So basically what I said right now that if this page is not a single Up page, then do something. Okay, So this is another symbol that you come across a lot with conditional statements. Now, let me also mention one thing real quick, because it's important. You may have noticed that with this if statement, there is the end if condition right here. So basically we're ending the conditional OR function. You don't always have to use the end if, if you've gone in the if statement, okay. It's not always necessary, however, for good practice, I would recommend that you always close your if statements. So in this case right now, op here, our simpler, come back in here and say PHP and then end if. And there it is, had the semicolon and then close the PHP tag. It's good practice, but lambdas mentioned that you're not always going to find developers who would always close every single one of the if statements. In my case right now, the reason why I did not close this initially was because within this block right now, I'm not wanting any other conditional statements like this is the only IF statement in this block. However, if I was going to run another conditional statement within this block, I would have ended the first one. But like I said, it's often good practice to just end all your if statements and to avoid any potential issues with your code. So that's it. Thank you for watching and I will see you in next class. 8. WordPress Functions: Okay, So let's start talking about functions and how you can make your very own functions using PHP in WordPress. Now previously we saw this particular function that I created called our print greeting. And the whole job of this function was just to display the text. You are very welcome. And it's very, very straightforward. You have the function and then you have the name of the function. You will have your brackets, and then you'll have the open curly brace to introduce HTML. You close it up and then right here, this is where the function gets called. Okay, let me show you something else right here. If I go to PHP.net and then take a look at the function reference. Right here you will see all the pre-built functions available with PHP. Now these can be used to do soul many things like check the day, Today's date. It can check whether a user is logged in and so on. And then down here, if you scroll through, you begin to see the different kinds of extensions are lighter. You have the date and time related extension. So if I wanna do something with the time, this is what you will have the available functions. Now one of them is the date function. Vevo a very straightforward, it's simply displays the date. Now there are different ways how you could choose to display the date. So as an example down here, you have access to the different examples. So if you said echo dates and then in brackets you have L. This would simply print something like Monday, Tuesday, Wednesday. If you wanted something different, like let's say Monday, 8th of August 2005 and then the time you would use something like this and so on. Okay, I'm gonna go over to my notepad file in here. Let me grab this real quick. Go right here to my header dot PHP. And I'm going to go ahead now and open this up. Let me paste the code right there. So what I'm doing right now is I'm simply echoing today's date in my header. I'm going to go ahead now and save this. Let's go back to the browser. Go back in here, refresh the page, and there you go, Monday 31st of May 2021. Now, notice that I didn't have to create a function or anything like that. All I simply needed to do was just to use the actual PHP function directly dates. So this is one picture directly. I simply used echo to print out the dates in this particular format. So that's one way how you can create your own functions or that I use functions directly from PHP. But what if you wanted to use your own functions? Right? Here is a thin with water S. We already have access to very wide variety of PHP functions. Now if you go to developer, the WordPress.org, and then you search for thin functions. Right here you will have a bit more explanation about functions.php file and things like that. Now the whole job of functions are like plugins. Plugins are used to perform certain kinds of actions on our website. You could have a plugin that does something very, very simple. And of course you could choose to install the plug-in. But guess what? You could even write a function, your own function that does exactly what our plugin is supposed to do. So in other words, if you're capable of writing your own functions, you will not need certain kinds of plugins. So as an example, take a look at this. All right, I'm going to open this up. Right here. You have your function refers on the walker S. Now, just like with PHP that has several pre-built functions. What Chris also has its own set of pre-built functions that you can use to either create your own new set of functions or you can simply customize them. Light here. Now the function of offense, you have access to plenty of functions. You have those on the posts or custom post type is pages. So anything related to a page or post and so on. You will have all the functions wide here. And then on the categories and tags, you have them right here as well. Let's cool down. Can see so many. And then anything related to like the user email address, user password, things like that. You will have them in here. You have your feet functions, and then you have anything related to comments, pink backtrack back functions and so on. Scroll all the way down here you have themes related functions and so on and so forth. Okay, with that been said, let's creates a very, very simple function that will check to see whether a user is logged in or logged out. No light here. We actually have sorted function which is called as user logged in. All this does is that it checks to see if a user is logged in or logged out. And then you can then do anything you want the function to do. So let me go over here to my file. And I'm going to grab this code real quick. Let's go back to our Notepad file right here. I'm going to remove this. Then a paces are here. And let me explain to you exactly what is going on in here. So what we have here is a very simple PHP code that checks to see if a user is logged in. And then if the user is logged in, we're going to echo welcome registered user. Else, if the user isn't locked in, just say Welcome visitor. So this is what we refer to as a conditional statement or a conditional function if you prefer. Basically we're offering two alternatives. It's either the user is logged in, any visa is locked in, then just say welcome registered user. But if the user is not logged in the industrial welcome, visit. All gonna go ahead and now to save this. And let's see what it's going to do. I'm going to go to my Firefox browser in here. Now, as you can see right now, I'm logged out and logged in. So let me refresh. And you can see it says Welcome visitor because I'm not logged in. However, if I go to my Chrome browser, all right, you can see I'm actually logged in right now as the admin. If I refresh. Now if you see a welcome registered user. So you can see right now that the function actually walks properly. Now going back to what Chris, right here, there are so many functions in header we're allowed to do so many thins. You can check to see if the user eases in a mobile device or not. You can print out the title of a post. You can check to see their posts as a featured image and so on. So what we've done in this particular video is just very, very, very simple functions to do certain things. Germany, the next video where we'll now take a look at more advanced functions. 9. Actions and Filters: Let's now take a look at some more advanced functions and specifically hooks, actions and filters. What exactly are these? A hook is a very generic term that is used to describe a location or a spot where one piece of code can interact with another piece of code. Now, don't worry, you will see what I'm talking about in just a moment. Now when it comes to hooks, there are generally two types. All right? You have actions and then you have filters. And action literally acts, it does something. So let's say for example, you wanted to create a scenario where once you've published in new post on your website, you want what purse to send out a tweet to all your subscribers. The action of sending out that tweets is an action. So basically that's what actions are and why it here, if you go to the WordPress codecs and you search for the action of reference. In here, you will see a whole list of different actions that have already been created by WordPress, which will do something for you at a particular point. So say for example, you wanted to do something before the theme is loaded. This would of course be advanced stuff. Right here you have the action called setup on the score theme. When you run this action, you will be able to do something before the theme is loaded. You can use this action register, our sidebar to basically eight side bars and so on. But what about a filter? A filter is used to modify data before it is used or displayed on your browser. That's basically what filters. So filters, they change things, they change stuff. In fact, a very easy way to describe actions would be they do stuff while filters change stuff. One other major difference between actions and filters is that an action will not provide you with any data to walk with actions, to just act, did do that job and then they get out. Filters, on the other hand, will give you something that will give you a piece of data to work with before they now run the function. A classic example would be the typical excerpts that you have four Press. By default, I think it's about 50 words or 55 was that workers would use for your excerpt. If you wanted to change the number of words in your post excerpt, you will need to use a filter because you need to get your hands on deck except first, and then modify the number of words. And then you will now pass your magnification back to the filter, which will then run. Let's take a look at some examples in here of an action and a filter. And right now I've already written out a function, so let's just quickly grab that right here. And of course we're going to go to our functions.php because this is where we typically would add our actions and filters. So what is going on in here, by the way, I'm not sure if I've mentioned this, but another way of adding comments in your PDF, I would just be to add the forward slash two times and then you can add your text or your comments. So what I'm trying to do here is that I am trying to add a statement that will appear on the front page. But then if it's not on the front page, don't do anything. So this is right here. The function is called add, promote text. That is the name of my function. And you can see right now, I've added recommended sees. If we're not on the homepage, don't do anything. Otherwise, if it is not the front page, then I want you to return or printouts hot per mole is back again. So to take this a little bit further, I'm using echo to print out the statement COCOMO is back again. But then we're also using the H2 tags to wrap it up to make it a little bit bigger. So once again, check this out. I am saying that my function is called ad promote texts, right? In fact, let me expand this just a little bit so you can see it a bit clearer. So once again, the name of the function is add promo text, okay? And the job of this function is to echo hot promo is back again only on the homepage because right now it says if we're not on the homepage, don't do anything. Otherwise, if we are on the homepage, then echo this out. That is the function. How ever we now need to add it as an action, and that is the statement wide here. In fact, you can actually even have this. Add action at the bottom. Okay, so sometimes you might see some developers adding the action first and then the function. In other cases, you'll have the function first and then the action. So we have this actual action of functions have called Add action. And for ADH action it requires two parameters. The first one is basically going to be the name of the action. In this case right now it is after header. And then the name of the function which in this case is add promo text. Fine. We've written out the function, we've added the action. But now, how do we actually execute this action? Keep in mind that just creating a function on its own doesn't necessarily mean that it will run. You need to call the function. You need to learn the function yourself. So how are we going to long this? Well, let's go ahead and save this first of all. Okay? And then let's just quickly grab the code right here. Real quick to action. I'm going to go over to my header dot PHP. And right here, this is where we want to print out the statement. So I'm going to say PHP. I'm going to paste the code, add my semicolon. I'll close the PHP code. This functional IT DO action. This is now the function used to call out an action that we've already created. And in this case right now the name of the action, going back to functions.php is what? Afta header, that is the name of the action. So right here we are now tend to what peers to do, do the action called AFTA on the skull header. I'm going to go ahead and have to save this. And let's see what the results. Let's go back to WordPress, to my site. I'm going to refresh the page. And okay, so right now, okay. We are on the homepage. So you say Hotmail is back again. However, if I was to go to the post for pitfall because you can submit it now there is no a hot noise back again. Let's go to the archive's page, for example. You can see it doesn't show up until we go back to the homepage. And then it says Hot promo is back again. So to give you a quick recap, this right here is the action that we've created called after header. And whenever you are adding an action, you need to first of all named the action which is APA header. And then you need to provide the function which you want the action to actually run. That function is add promo text. And this right here is the actual function. And then go into the header dot PHP. This is where we want to call that action that we've created. And we need to do so. We needed to use the function called do action. And then the name of the action is this right here, is what you might call a hook. Because now we're hooking our header dot PHP to our functions.php via the action called after underscore header. That's basically an action at work. Okay? Now, let's go back and let's talk about filters right? Now. Just like with actions filters basically, I'm sorry, not unlike, unlike actions filters modify data. They change data before it's actually used all displayed on the browser. And just like with actions, you have access to a wide variety of different kinds of filters. And vide here you can see many of them. You have fields us four pages, posts, image sizes and so on. Let me give you a quick example. Let's say we wanted to change the number of words in excerpts. Right now. The default, I believe is 55 characters, but let's say when it's make the except only four characters, how are we going to do that? I want you to realize first of all that there is a function called the excerpts. This right here will display the post excerpt on its own. All right, keep that in mind. Now, what I'm gonna do is I'm going to introduce you to a filter called excerpt length. This filter right here has been created about what PR specifically for us to be able to use to modify the excerpt length. You can say they say it's filled has the maximum number of words in a post. Accept, check this out. I'm going to go ahead and grab my code right here. Okay, let's go to our functions.php. And then down here, I'm going to paste that. What is going on in here. I have my function called my costume except lens. And check this out. I am returning the tea hammock, this 50 woods. And now, just like we'd add action, I am adding my filter. And just like when you use the add action, you first of all need to provide the name of the filter we are working with, which is what? Excerpt? Length. This is the filter from what purpose that we're using called Except length. And then just like we do, actually, you don't need to provide the name of the function that you're using to modify the excerpts, which is my costume excerpt length. However, on the like, the actual where we had to say Do action and then provide the name of the action. Because we already have a function called the excerpt. We don't need to do anything like that. All we need to do is just to call an excerpt vivid. Now the function to modify the except so only need to do now is just to call the excerpts. And how do we do that? Let's go to our content. They're singular PHP and y here, just below the title. I'm gonna say PHP is the underscore, excerpts, semicolon, and close. Let's go ahead now and save the file. And let's go back to our browser. And let's go to the page right here. Let's go now to this single page 4, page right here. And there it is. There is a excerpt of idea in 50 words. Let's actually confirmed it's true. I'm going to go back, change our 32 four. Okay, just to make sure that it's actually accurate. Let's save that for is lot easier to count it on Thursday, so let's refresh. And there you go. 1234. That is a filter in action. We use the filter again because we needed to get our hands only accept first, and then we then modify the number. We sent it back. One other thing I want to mention is that when it comes to use an actions or filters, we do actions, right? You do an action. This is the function, it's called do action. But FIR filters, we apply filters. So when you're going through your WordPress files, you will see apply filters in some locations. While you will see actions, you will see dual action. You don't do filters or apply actions. You do actions and apply filters. There's a lot more to actions and filters, but at this point you have a basic understanding of how they work and what the AP thank you for watching and I'll see you next class. 10. Variables and Arrays: So now let's talk about PHP variables and arrays and how they are used in WordPress. Now, think of a variable as a container that can store the value of something. That something could be a function. It could be text, it could be a number, it could be anything. Now akathisia documentation in here, variables are typically represented by the dollar sign. Now, I've always found that whether interests like why did they choose the dollar symbol as the sign for a variable? It's not important, That's a whole topic for another day. But usually you will have a variable that we'll start with a dollar sign and then you'll have the actual name of the variable. So that's how you can identify a variable. And there are different types of variables used in PHP, you have integers, integers would be your numbers, 0, 1, 2, 3. You have string, string could be your texts. You also have your Boolean variables which would be true or false, and so on. Now, scrolling down here you can see examples. The first example in here you have variable va equal in Bob. So developed a variable v is Bob. And then note that the second one in here that has the value of G 0, this variable here as the capital V. So please note that variable names are case sensitive. If one is smaller, Toledo, and is a capital letter, those are two different variables and tallied. When you try to echo out these variables, you're going to have Bob and Joe. And in fact, let me give you a live example in here. I've already written out the code. So let me go over to my notepad. Let's just jump down in here, open up my PHP Doc the code, and then close the PHP. So all you have, you have right now is that I have created a variable called text. You can see that the loss anyway, deer ticks equals PHP for HIV. So this is in a string variable and now echoing out the text. So instead of me writing echo PHP for life, I'm just simply echoing text because texts variable has developed of PHP for life. And of course, if I save this, and I go back to my website right here and I refresh the page up there, you're going to see PHP for life, so very, very straightforward. You can also assign functions to variables. Have another example in here I've written out, this is an, this is a function that we've taken a look at, Elea, the one with the date. So let me just go ahead, open up my PHP tags again, dump the code, closed out there. So again, we've assigned the variable date to be equal to the function of date, the PHP function data. And then in brackets we have l, which means that it will represent the day of today. Basically gonna go ahead and now to save this. And then if I go back to my website, by the end, I refresh the page. You can see that today is Thursday, so Poetry for Life entity is Thursday. So that's basically how variables are function. Going back to the manual in here, they have so much more examples on how variables are used. But let's move on now to always because this is actually the more interesting. So in here, according to the documentation, it says that away in PHP is actually an ordered map. A map is a type that associates values two keys. As an example, right now you have your array right here. You have the key, and then the kid will have its value. You have the second kid, I will have its own value, and so on. Basically think of an array as a particular function or a variable that has a set of attributes or characteristics. You can think of your vaguely, our texts in your website, write a text can have an away and that ever could be things like, okay, we want to have a specific color for this text of that color right now would be a key. And then the color will have a value. Is it red, Is it blue, is green? You can have the font size. Font size could be the key, so the value could be 26 pixels, 30 pixels. It could have a font-family, which would be Monsanto, Tahoma, and so on. That's basically what an array is. You will find our ways all lot in walkways n, and we have several examples in there to show you able to make functions.php wide here. This is the function to register a sidebar, right? So it's called 2021 budgets. And then this is the actual preview function of Register sidebar. But now note that we have the old way and in the airway we now have several several keys, which would be the name, for example, what is the name of the sidebar? 0, the value is it's called the FUTA. What is the ID? The ID is sidebar dash one. What is the before title? We're going to up an H2 class before the title and then the closing H2 tag after the title, and so on. So why did you have the array with the keys and the values of those keys? Going to give you another example up here. And this one is actually very, very, very interesting vide here. So you have this function called add theme support. This is a preview function with what? Because that allows you to add our customization options to your theme. Now in this case, right now, we're adding the support for a custom background. I'm going to show you something very, very good because I want you to see how this actually works. If I go to Customize, this is where the 2020, one thing just to remind you, if I go to Customize right here and we go to My apologies, my internet is actin all weird again today. Okay, so if we go over to colors and dark mode, right here you see backbone column. We have the ability to customize the background color because of this function right here, add support for custom background color. Now look at this. We have the airway default color is set to D100 for D, D, which is kinda like a light shade of green. If I go back to my website right here, do you see the beck and call this as the default and click in there. What's the value D14, dd. It is right here. But notice that down here, we have other close that we can quickly choose. You have like the black hollow, you have another shade of black. You have like pink and so on. All these values are right here. Do you see them? This is the black variable that has this value. That grade has the value 0, it has that value, and so on. So the thing is, as you begin to walk with WordPress, you will come across variables and always, always are very, very common. Open up your functions.php of anything and you will see them everywhere, away, away, away. You will see the keys and then use it the values of those keys. So that's a very brief introduction to the world of variables. And I waste thank you for watching. I will see you in the next class. 11. The WordPress Loop Re: No costs about what press and PHP would be complete without talking about arguably the single most powerful function in all of what prayers, which is the WordPress loop. What exactly is this? I've got some books in here with me and don't worry, I'm not trying to sell them to you. I have three books in here, right? And each of those books has its own title. They have their own author, their own number of pages, their own classification, and so on. Let's imagine that you're a librarian and it was your responsibility to record all this information about each and every one of these books. You could do manually. But what if you could actually create a function or a program that could scan these books and then automatically put out the information that you want. That would be awesome right? Now, think of this books as your WordPress posts. Think of that program that can scan this post and the spleen information as to what press loop. So the job of the loop is basically to go into your posts and then start picking out the information, the title of the post, the author of the post, date of the post, and then we'll display it on your website as basically what the loop does. Now I do have another article in here, what the loop can display. It can display the next post link, the previous post length that category of the post, the author of the content, the excerpt, the ID, the short link tags, that'll time. It also walks a conditional tags as well. If this is the homepage, then display this. If this, if this is not the homepage, do that and so on. Now, let me open up my mental part file in here and writer, if you open up your index.php, in fact, any one person's name, I don't care how sophisticated the theme is. You're going to have a loop in your index.php and wide here, this is the loop. While half poses assessment, if half poster, basically the same. If the website has posts, and as long as it continues to have posts, then do this. Right now you said this function called get template part. This is basically a function that links 11 file to another file. So where Lincoln the index.php right now to the, to the content dot PHP file, which is inside where you have the ideal content, that single dot PHP file. So a link in the index.php file in here to this particular file right here. So once the loop has started in the index.php, this is where we now begin to output the information. So we have the title, you have the thumbnail, you have the content, and so on. Now of course, you can customize what personal to display, setting kinds of information. You can tell the loop that hey, instead of displaying all the posts, display posts only from this particular category. Instead of displaying posts, might not display my custom post type of movies. In fact, I've written an example in here just to show you real quick how it might look like. So Lambdas dog that right here real quick. So right now you can see we've done what we've created a variable called args. This could also, I could also call this loop costal loop and so on. But for the purposes of this video app name my variable args and his rebel now has an overbite and about areas previously. And look at the keys. The first one right here is the post type. So now I'm telling you that, hey, peak, the information from the post type of movies now we're not dealing with a regular good old water has posed by the limit movies. And then for the category name, pick movies that are home the specific category of action, action movies, only red and then post papilla this in this loop on display three movies. This would be how you can customize the what, who is loop. So again, the job of the loop is to go into your posts or whatever custom poster that you've set it to focus on. And then begins to pick out the information that you want, the number of posts, the category of the posts, and so on. And then using our template tags like the tide tool, they observed the content. We can then dictate what information did Luke should display. That's basically how the loop works. There's of course, so much more to the walkway slope, which I will go into, of course, in my main theme development course. But for now, I think I've been able to give you a brief introduction to the WordPress loop and what it does and how it actually works. Thank you for watching and I'll see in the next class. 12. PHP for WordPress Conclusion: Well, so that's it. We've come to the end of this course, learn PHP for what price? And from the bottom of my heart, I sincerely hope that you enjoyed and found the course useful. If you did, please do consider leaving a review for the course, it really would help me a lot. And if you're interested, like I've mentioned in the previous video, I do have a full course that will teach you how to become a WordPress developer. So interested, Be sure to check out the course. Thank you so much If you have any questions about anything I covered in this course, be sure to let me know and I'll do my best to answer them as soon as I can. My name is Alex, has been a pleasure ticket yourself and I'll talk to you next day. Jazz.