Introduction of template file for WordPress theme making

Source: Internet
Author: User
Get_template_part () is used to refer to template files, similar to Get_header (), Get_sidebar (), and Get_footer (), except that this get_template_part () can introduce a custom name file.

How to use

Get_template_part ($slug, $name);

Parameters

$slug

(string) (must) the file name of the template to be introduced, excluding the suffix name. php, that is, if you need to introduce the loop.php file of the current theme root directory $slug fill in "loop".

Default: None

$name

(string) (optional) The file name of the template to be introduced, if you want to introduce the loop-img.php file of the root of the current topic $slug parameters to fill in "loop", $name the Parameter Fill "img".

Default value: None

return value

There is no return value for this function.

Example

Endskin.com file that introduces the root directory of the current theme:

Get_template_part (' Endskin ');

Introduce the loop.php file for the current theme part directory:

Get_template_part (' Part/loop ');

endskin-com.php file that introduces the root directory of the current theme:

Get_template_part (' endskin ', ' com ');

Other

This function is located at: wp-includes/general-template.php

The above introduces the WordPress theme template file Introduction method, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.