Therefore, there is a WordPress website to adjust the theme, skim the template label, and implement functions in the built-in theme editor. You may have modified the PHP file. Now let’s take the technology to the next level and look at more code. Fortunately, WordPress is a good place to start. You can use a lot of documentation, and most of the code is easy to read, does not need instructions, and is not difficult to remember. This article provides a brief introduction to the programming world of word press. This post is for beginners, but it assumes that you have used word press before and know the default HTML. I assume you know how to edit WordPress files. Even if you don’t understand what’s happening, you also investigate WordPress theme files. The
The programming language of WordPress word press uses multiple programming languages. If you have to choose a language as the \
Finally, WordPress also uses MySQL for database queries. MySQL is used to search the database for the last 10 posts or all posts of a specific category. Very good. The bad news is that this is a fairly large body of knowledge. The good news is that there is no need to know everything to get started. In fact, you can live small. About 8 years ago, I learned programming by copying and pasting examples from documents through WordPress. As I mentioned in the memos of people who have experienced everything, I have learned through tutorials, documentation, and other people’s work. I am where you are now and have gone through all the stages you will go through in the future. Programming difficulties do not come from the complexity of the relevant languages. Breaking down into components makes learning easier. The
I find programming difficult for two reasons. You need to know a lot of simple things, and in order to create a successful product, you must think from a system perspective. It takes some practice. What I really want to tell you is that in the process of learning how to encode WordPress, you will have a lot of \! moment In the early stages, you will be frustrated by insufficient understanding. You will think that the perfectly formed code will not work. You will spend hours discovering that you have forgotten the semicolon. All this is perfectly normal. All successful programmers feel this. It’s not just you. If you continue with it, I guarantee that you can code the topic in a short time. The
It is important to realize that there is no \
WordPress, Joomla, Drupal, and all other systems and frameworks are the same components.
Build. The difference between them is the coding philosophy and methodology they use. As mentioned earlier, PHP works as a server-side scripting language. In contrast, html is the client language. To understand what this means, let’s analyze HTML first. The browser parses HTML code as follows: If you visit an HTML page, the HTML code is sent to the browser. Your browser processes information and recognizes you as a web page. The
When a browser accesses a page that uses php, the intermediate steps are used. First, the PHP code is processed by the server. The result of this processing is an HTML page that is sent to the browser and displayed. Additional processing on the server may seem like an unnecessary step, but it is far away. Let’s look at a practical example of actual PHP code. In the d2a4aa5bedec00b5e8b3 payload, you can collect some information even if you don’t know the PHP code. Read it directly. You are the specific setting of the situation. In fact, for our display screen, \
From the source of the result page, there is no trace of this code. Only \
Considering the last paragraph of PHP in WordPress, PHP can be recognized everywhere in WordPress. Content in the twenty four basic topic. Let’s open and view PHP. This file serves to display the content of the blog post in the topic. Let’s compare the first line of the file (discard the comments at the top) Summary d2a4aa5bedec00b5e8b3 loading… The output generated when accessing the page and: in the comparison of summary d2a4aa5bedec00b5e8b3 loading, we can infer that the_id() function is replaced by the ID of the post. The post_class() function adds many classes to HTML elements. This helps you specify the post style later. In this step, it is not important to know why these specific classes were added. We are just used to the function. The
Further, if you look at lines 24 to 28, you can also see the running if statement. In the route d2a4aa5bedec00b5e8b3 of the important place, the if gate has is_single (). This is a function. If we are viewing a single post page, it is true; otherwise, it is false. If this is true, and on a single page, use the_title() function to output the title. If false, the_title() function is still used, but make sure it is a link to a single post page. Some functions are \
Items in parentheses are called arguments. Each function has different arguments, separated by commas.
And documentation. Codex’s \title () article shows that the function has three arguments. The first argument allows you to add HTML before the title. The second allows HTML to be added after the title, and the third parameter determines the weather that the title is displayed (reversed) or saved for later use. Based on this, now is the content. See what happens on line 25 of the PHP file. When the summary d2a4aa5bedec00b5e8b3 is loaded, the function displays the title, but adds the H1 start tag to the front and adds the end tag. In the browser, the result of this code is as follows: In the summary d2a4aa5bedec00b5e8b3 load, you may not want to spend weeks poring over the PHP documentation to learn everything from the start. Although this must be done, it is recommended that you do as many experiments as possible. Do you want to move the tag list from the bottom of the article to the top? Content The_tags() function at the bottom of the PHP file looks promising. First, delete it together. Then, when you save and refresh the page, the tag list disappears. This is great. This means that this is actually a function of outputting tags. Now, copy and paste the file into different parts of the file to determine where the file ends. The more you climb up in the code, the more likely you are to climb up in the article. Experience can identify the contents of the_extract() and the_content() of the same thing, so it is placed on the main content, which can be seen everywhere. It’s fun to learn how to code WordPress in this way, and it’s best to read the documentation. It’s always a good thing. Don’t worry even if you don’t know everything. You will soon understand. One disadvantage of this method is that it uses bad habits. It is recommended that you copy and paste the_tags() function to the top of the file. However, the footer the_tags() HTML that uses footer tags needs to be modified to make it good code. Again, please forget this now. We didn’t build expert production ready code for Google. You are learning the basics and trying to figure out how everything works. This is not an easy thing. Mistakes are part of the process. If you have the operating knowledge of the code behind word press, you can study the coding mode without learning bad habits and understand the reasons for operating in our way. Important word press code overview word press has several \
The Ma sub topic is a separate topic based on the parent topic. Inherits all content from the parent topic unless otherwise specified. This is the only safe way to modify the theme. As mentioned earlier, the easiest way to learn is to modify an existing topic. I want to add \
. In the summary d2a4aa5bedec00b5e8b3 loading, the first line uses the if statement combined with the have_posts() function to find the posts returned in the query. If there is no post, run the code after the else section to tell the user that there is no post. If there are posts, please use the PHP loop. PHP has several types of loops. For syntax and more examples, see the PHP loop type tutorial. In the above code, use the while ring to re include the have_posts() function. This function has no posts or shows all posts in the loop, so it will return false when there are no more posts in the loop. When the value of this function is true, everything in the while ring will run. This is what we need. When the last post is displayed, the have_posts() value is false and the loop terminates. In the ring, you created a very basic post display using the template tags you learned before. The ring must be used in all topic template files that list posts. Search page, single post page, archive page, index file – use loop every time you list posts! Although it is not common to learn custom queries too early, in my experience, this is one of the most commonly used features of WordPress. In the previous section, you learned how to use a loop to list posts, but by default it is limited to the items returned. How to display related posts of the same category under a post? This is easy to do with custom queries and loops. You can use the wp_query class to create custom queries. Class is now on our head, but it is easy to use. The following is an example of a specific category of reserved posts: You can use it to display the upcoming category section. As you can see in the important d2a4aa5bedec00b5e8b3 load, this is very simple. To modify it as needed, you can adjust the contents of the $args array. Based on author, category, custom field, etc., there are many parameters that can be used to restrict posts according to the publishing date! For a complete list, see the wp_query documentation. Now that you have a custom query, you can use a custom ring to display content. What we need to do is prefix the have_posts() and the_post() functions with the variable name containing the query and the \
For example, hooking allows you to run one of the only features when posting in word press. For example, you can notify the creator. Filters allow you to modify data before using it. For example, you can use filters to modify the text that is displayed to users when a post is saved. \
Recommend hio’reilly and abress books. HTML, CSS, and JavaScript W3Schools – W3Schools contains complete tutorials and more for all these languages. Amazon books – Amazon has many books about each language or three languages at a time. HTML5 doctor – get a good place to learn new tags and HTML5 subtleties help wpmu dev forum – our forum is a good place to ask for help! Stack overflow – very popular coding related forum WordPress Support Forum – Official WordPress forum advanced topics sass – CSS less with super capabilities – CSS OOP PHP with variables and functions – object oriented PHP SQL tutorial – learn how to query the database directly laracasts – the latest PHP and laravel tutorials koala – free, free Cross platform code compiler preprofirst – advanced Cross platform code compiler codekit – my favorite OSX code compiler groove – free terminal based code compiler website wpmu development WordPress news switching magazine toz+ list drop specky boy web design Dean codethous automatic news WP shipyard picture credit: James Cleveland. What resources do you use to learn WordPress programming? Please share tips in the comments below.