How to introduce template File into WordPress
This article mainly introduces how to introduce WordPress template files, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Get_template_part () is used to reference template files, similar to get_header (), get_sidebar (), and get_footer (), except that this get_template_part () can introduce a file with a custom name.
Usage
Get_template_part ($slug, $name)
Parameters.
$slug
(string) (required) the file name of the template to be introduced, excluding the suffix .php, that is, if you need to introduce the loop.php file $slug of the root directory of the current theme, fill in "loop".
Default: None
$name
(string) (optional) the sub-file name of the template to be introduced. If you want to introduce the loop-img.php file $slug parameter of the current theme root directory, fill in "loop" and $name parameter "img".
Default value: None
Return value
This function has no return value.
Examples
Introduce the endskin.com file of the root directory of the current topic:
Get_template_part ('endskin')
Bring in the loop.php file of the current theme part directory:
Get_template_part ('part/loop')
Introduce the endskin-com.php file of the root directory of the current topic:
Get_template_part ('endskin',' com'); Thank you for reading this article carefully. I hope the article "how to introduce WordPress into template File" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!