Explains the PHP functions used to get Comment templates and search forms in WordPress, wordpressphp
Comments_template () (Get comment template)
The Comments_template () function is used to get a comment template, which can only be used on articles or pages, if not articles or pages that cannot be displayed.
Usage
Comments_template ($file, $separate _comments);
Parameters
$file
(string) (optional) to comment on the template file.
Default value:/comments.php (the comments.php file for the current topic root).
$separate _comments
(Boolean) (optional) whether to differentiate comments based on the type of comment.
Default value: False
return value
There is no return value for this function.
Example
The default comments.php file that introduces the root of the current theme.
<?php comments_template ();?>
To introduce a custom file:
<?php comments_template ('/short-comments.php ');?>
Other
This function is located at: wp-includes/comment-template.php
Get_search_form () (Get search form)
The Get_search_form () function is used to get the search form, and the code for the search form is located in the searchform.php file of the current topic root directory.
Usage
Get_search_form ($echo);
Parameters
$echo
(Boolean) (optional) If true, print the search form directly, or return the code for the search form if it is not true.
Default value: True
return value
(string) If the $echo argument is False, returns the Html code for the search form.
Example
If the theme root directory does not have a searchform.php file, the default is the form code below:
Other
This function is located at: wp-includes/general-template.php
Articles you may be interested in:
- WordPress Theme Authoring in Get header template and bottom template
- Introduction of template file for WordPress theme making
http://www.bkjia.com/PHPjc/1085878.html www.bkjia.com true http://www.bkjia.com/PHPjc/1085878.html techarticle explain the PHP function used to get the comment template and search form in WordPress, wordpressphp comments_template () (Get comment template) comments_template () function to get the comment template, ...