WordPress V4.0+Template Tag Reference Guide as of Version 4.2
Presented by DBS > Interactive Development :
Include Tags
Comments Template comments_template();
Loads the comment template. For use in single Post and Page displays.
<?php comments_template($file, $separate_comments); ?>
$file
String • Default: '/comments.php'
(Optional) The file to load.
$separate_comments
Boolean • Default: false
(Optional) Whether to separate the comments by comment type.
Get Footer get_footer();
Includes the footer.php template file from your current theme's directory. If a name is specified then a specialized footer footer-{name}.php will be included. If the theme contains no footer.php file then the footer from the default theme wp-includes/theme-compat/footer.php will be included.
<?php get_footer($name); ?>
$name
String • Default: none
(Optional) Calls for footer-name.php.
Get Header get_header();
Includes the header.php template file from your current theme's directory. If a name is specified then a specialized header header-{name}.php will be included. If the theme contains no header.php file then the footer from the default theme wp-includes/theme-compat/header.php will be included.
<?php get_header($name); ?>
$name
String • Default: none
(Optional) Calls for header-name.php.
Get Search Form get_search_form();
Display search form using searchform.php Theme file.
<?php get_search_form(); ?>
No parameters.
Get Sidebarget_sidebar();
Includes the sidebar.php template file from your current theme's directory. If a name ($name) is specified then a specialized sidebar sidebar-{name}.php will be included. If the theme contains no sidebar.php file then the sidebar from the default theme wp-includes/theme-compat/sidebar.php will be included.
<?php get_sidebar($name); ?>
$name
String • Default: none
(Optional) Calls for sidebar-name.php.
Get Template Partget_template_part();
Loads a template part into a template (other than header, sidebar, footer). Makes it easy for a theme to reuse sections of code in an easy to overload way for child themes. Includes the named template part for a theme or if a name is specified then a specialized part will be included. If the theme contains no {slug}.php file then no template will be included. For the parameter, if the file is called "{slug}-{name}.php".
<?php get_template_part($slug, $name); ?>
$slug
String • Default: none
The slug name for the generic template.
$name
String • Default: none
(Optional) The name of the specialized template.
WP Enqueue Scriptwp_enqueue_script();
The safe and recommended method of adding JavaScript to a WordPress generated page is by using wp_enqueue_script(). This function includes the script if it hasn't already been included, and safely handles dependencies.
<?php wp_enqueue_script($handle, $src, $deps, $ver, $in_footer); ?>
$handle
String • Default: none
Name of the script. Lowercase string.
$src
String • Default: false
(Optional) URL to the script. Example: "http://example.com/wp-includes/js/scriptaculous/scriptaculous.js". This parameter is only required when WordPress does not already know about this script. You should never hardcode URLs to local scripts, use plugins_url() (for Plugins) and get_template_directory_uri() (for Themes) to get a proper URL.
$deps
Array • Default: array()
(Optional) Array of handles of any script that this script depends on (scripts that must be loaded before this script). False if there are no dependencies. This parameter is only required when WordPress does not already know about this script.
$ver
String • Default: false
(Optional) String specifying the script version number, if it has one, which is concatenated to the end of the path as a query string. If no version is specified or set to false then WordPress automatically adds a version number equal to the current version of WordPress you are running. This parameter is used to ensure that the correct version is sent to the client regardless of caching, and so should be included if a version number is available and makes sense for the script.
$in_footer
Boolean • Default: false
(Optional) Normally scripts are placed in the <head> section. If this parameter is true the script is placed at the bottom of the <body>. This requires the theme to have the wp_footer() hook in the appropriate place. Note that you have to enqueue your script before wp_head is run, even if it will be placed in the footer.
Add New List Items wp_meta();
By default, wp meta() is called immediately after wp_loginout() by sidebar.php and the Meta widget, allowing functions to add new list items to the widget.
<?php wp_meta(); ?>