WordPress General Functions

About This Index
This page is the WordPress General Functions index. Each row links to a full guide with syntax, three examples, and FAQs.
Learn what general template tags are and how themes use them on WordPress General Functions. Use this page when you need one function, such as bloginfo(), get_header(), or wp_enqueue_script().
bloginfo() prints a value and get_bloginfo() returns it. Load theme files with get_header(), get_footer(), and get_template_part(), and add scripts with wp_enqueue_script() on the wp_enqueue_scripts hook.
How to Call a General Function
Most of these functions go in theme files. Some print right away, and some return a value that you echo.
<?php get_header(); ?>
<h1><?php bloginfo( 'name' ); ?></h1>
<?php get_template_part( 'content', 'single' ); ?>
<a href="<?php echo esc_url( wp_login_url() ); ?>">Log in</a>
<?php get_footer(); ?> WordPress General Functions Table
All function guides in this WordPress general series (29 tutorials). Start with bloginfo() and get_header().
Site info
4 functionsRead the site name, tagline, URL, version, and page title.
| Function | Description | Tutorial |
|---|---|---|
bloginfo() | Print site information such as the name, tagline, URL, and charset. | Read guide |
get_bloginfo() | Return site information such as the name, tagline, URL, and version as a string. | Read guide |
wp_title() | Print or return the page title for the head of the page (older theme method). | Read guide |
get_current_blog_id() | Get the ID of the current site (always 1 on a single site install). | Read guide |
Template loading
5 functionsLoad the header, footer, sidebar, reusable parts, and the search form.
| Function | Description | Tutorial |
|---|---|---|
get_header() | Load header.php or a named header file such as header-home.php. | Read guide |
get_footer() | Load footer.php or a named footer file such as footer-shop.php. | Read guide |
get_sidebar() | Load sidebar.php or a named sidebar file such as sidebar-shop.php. | Read guide |
get_template_part() | Load a reusable template file such as content-single.php. | Read guide |
get_search_form() | Print or return the site search form. | Read guide |
Archive titles
6 functionsPrint the title of a post, category, tag, term, month, or post type archive.
| Function | Description | Tutorial |
|---|---|---|
single_post_title() | Print or return the title of the current post or Page. | Read guide |
single_cat_title() | Print or return the name of the current category on a category archive. | Read guide |
single_tag_title() | Print or return the name of the current tag on a tag archive. | Read guide |
single_term_title() | Print or return the name of the current term on a category, tag, or custom taxonomy archive. | Read guide |
single_month_title() | Print or return the month and year of the current monthly archive. | Read guide |
post_type_archive_title() | Print or return the title of a custom post type archive. | Read guide |
Archives, calendar & links
5 functionsList archives, build archive links, and show the post calendar.
| Function | Description | Tutorial |
|---|---|---|
wp_get_archives() | Print or return a list of monthly, yearly, daily, or recent post archives. | Read guide |
get_archives_link() | Build one archive link as a string in html, option, link, or custom format. | Read guide |
get_calendar() | Print or return a small calendar table that links to days with posts. | Read guide |
delete_get_calendar_cache() | Clear the cached calendar so get_calendar() builds a fresh one. | Read guide |
calendar_week_mod() | Get the day of the week as a number from 0 to 6 (a modulo 7 helper). | Read guide |
Auth & meta helpers
9 functionsLogin and logout links, the login form, the Meta list, allowed comment tags, and scripts.
| Function | Description | Tutorial |
|---|---|---|
wp_login_url() | Get the address of the login page, with an optional redirect. | Read guide |
wp_logout_url() | Get the address that logs the current user out, with an optional redirect. | Read guide |
wp_lostpassword_url() | Get the address of the "Lost your password?" page. | Read guide |
wp_loginout() | Print a Log in or Log out link, depending on the visitor. | Read guide |
wp_login_form() | Print or return a ready-made login form for the front end. | Read guide |
wp_register() | Print a Register link for guests or a Site Admin link for members. | Read guide |
wp_meta() | Run the wp_meta action so plugins can add items to the Meta list. | Read guide |
allowed_tags() | Get the HTML tags allowed in comments as a text string you can print. | Read guide |
wp_enqueue_script() | Add a JavaScript file to the page the safe WordPress way. | Read guide |
Frequently Asked Questions
Start with allowed_tags()
Get the HTML tags allowed in comments as a text string you can print.
14 people found this page helpful
