In the open source second-open imitation brand website building technology, the commonly used frameworks include opencart, magento, wp framework, etc., and zencart is a relatively old and outdated technology, which is generally no longer recommended. Today, we mainly focus on the wordpress framework and make a macro introduction to let friends who develop programs have a general understanding of wordpress. If you use the wordpress framework to build a counterfeit brand website, you can use wordpress 5.72 + woocommerce. The big framework uses the AB+ dual server framework. In the payment link, it also uses anti-crawler avoidance methods such as entry cloak replacement and IP library filtering. If the turnover funds are relatively large, it is assisted by weight matching, amount matching, random collection and other round-cutting methods to collect payments safely.
Although the startup process of WordPress is a very tedious and complicated process, it is essentially a process started by a series of Hook hooks. We do not need to care about the complex logical relationship. We only need to know the execution order of the hooks, at which stage to load the plug-in API, at which stage to generate user credit information, etc.
The startup process before SHORTINIT
WordPress-hook execution order
WordPress responds to index.php requests after SHORTINIT test fails and continues to start
WordPress wp() function
Next, let’s take a look at the code structure of WordPress and the calling relationship between modules:
After the program is deployed, open ftp, and the code distribution is as follows:
wp-admin: wordpress site backend module,
wp-content: wordpress themes, plugins and localized storage directory,
wp-includes: wordpress some class and public function file storage directory,
index.php in the root directory is the entry module for most wordpress functions.
The calling relationship is as shown below:
The above process mainly includes three parts: global initialization, data reading and template rendering. Among them,
wp-load.php makes a series of function calls, defines global variables, and references necessary php files;
wp() functions mainly call class methods in wp-include/class-wp.php to implement different request preprocessing, and then load the corresponding data into the global object for subsequent template page display;
template-loader.php implements loading different templates according to different url parameters,
and the template loading process is as follows:
The above code clearly shows that the program loads different template PHP files according to different page types.
The get_query_template function obtains the template file path of the specified type. You can enter the function and view its implemented functions, as shown below:
The locate_template function determines whether the corresponding template exists. If it exists, it loads it. Otherwise, it returns the path of the template file. You can also enter the function to view its implemented functions, as shown below:
In summary, we clearly know that these functions are mainly used to select which template, how to get the template path, and display the loading process. With these cognitive foundations, we are very clear about the URLs of different parameters, template selection, and the PHP file process under the template.
The A-station server of the WordPress imitation website is also based on this set of hook sequence process and source code structure to start the mall business logic development, and then equipped with payment collection and in-site self-cloak technology, a complete site is developed.