100% found this document useful (1 vote)
77 views

The Time Saving Copy/Paste Wordpress Cheat Sheet: Basic Template Files Header Functions Navigation Menu

This cheat sheet provides a categorized list of commonly used WordPress template functions for building, updating, and maintaining templates. It includes functions for basic template files, header information, navigation menus, the post loop, and other miscellaneous functions. The cheat sheet is designed to be a quick reference for common WordPress template tags that can be easily copy and pasted.

Uploaded by

Logi Cheminot
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
77 views

The Time Saving Copy/Paste Wordpress Cheat Sheet: Basic Template Files Header Functions Navigation Menu

This cheat sheet provides a categorized list of commonly used WordPress template functions for building, updating, and maintaining templates. It includes functions for basic template files, header information, navigation menus, the post loop, and other miscellaneous functions. The cheat sheet is designed to be a quick reference for common WordPress template tags that can be easily copy and pasted.

Uploaded by

Logi Cheminot
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

WordPress Cheat Sheet Home Contact Tweet 57

The Time Saving Copy/Paste WordPress Cheat Sheet


Use this page for a quick, categorized list of WordPress functions that are commonly used when building, updating
and maintaining templates. Simple, Easy, Copy-Pasta . The quick guide to common WordPress > Template
functions.

Basic Template Files Header Functions Navigation Menu


File Name Description Function Description Default Navigation Menu

style.css style sheet file <?php site_url(); ?> root url for <?php wp_nav_menu(); ?>
website
index.php home page file Specific Navigation Menu
<?php wp_title(); ?> title of
header.php header content file specific <?php wp_nav_menu( array('menu' => 'Project Nav' )); ?>
post/page
single.php single post page file Category Based Navigation
<?php bloginfo('name'); ?> title of site
archive.php archive/category file <ul id="menu">
<?php bloginfo('description'); ?> site
searchform.php search form file description
<li <?php if(is_home()) { ?> class="current-cat" <?php } ?>>

search.php search content file <?php get_stylesheet_directory(); ?> stylesheet


<a href="<?php bloginfo('home'); ?>">Home</a></li>
folder
location
404.php error page file <?php wp_list_categories('title_li=&orderby=id');?>

<?php bloginfo('stylesheet_url'); ?> style.css file


comments.php comments template </ul>
location
file

<?php bloginfo('pingback_url'); ?> pingback url Page Based Navigation


footer.php footer content file

<?php bloginfo('template_url'); ?> template <ul id="menu">


sidebar.php sidebar content file
folder path
<li <?php if(is_home()) { ?> class="current-page-item" <?php } ?>>
page.php single page file
<?php bloginfo('version'); ?> wordpress
blog version <a href="<?php bloginfo('home'); ?>">Home</a></li>
front-page.php latest posts or static
page
<?php bloginfo('atom_url'); ?> atom url <?php wp_list_pages('sort_column=menu_order&depth=1&title_li=');?>

tag.php display tags in archive


<?php bloginfo('rss2_url'); ?> rss2 url </ul>
format

<?php bloginfo('url'); ?> root url for


category.php display categories in
website
archive format

<?php bloginfo('html_type'); ?> html version

<?php bloginfo('charset'); ?> charset


parameter

Template Functions The Loop


Function Description Basic Loop

<?php the_content(); ?> content of posts/pages <?php if(have_posts()) { ?>

<?php if(have_posts()): ?> check if there are posts <?php while(have_posts()) { ?>

<?php while(have_posts()): the_post(); ?> shows posts <?php the_post(); ?>

<?php endwhile; ?> closes loop <?php // custom post content code for title, excerpt and featured image ?>

<?php endif; ?> closes if <?php } // end while ?>

<?php get_header(); ?> header.php file contents <?php } // end if ?>

<?php get_sidebar(); ?> sidebar.php file contents


Extra Functions
<?php get_footer(); ?> footer.php file contents
Function Description
<?php the_time('m-d-y'); ?> the date is '08-18-07'
/%postname%/ custom permalinks
<?php comments_popup_link(); ?> link to comments of post
<?php include(TEMPLATEPATH . '/x'); ?> include file from template folder
<?php the_title(); ?> title of post/page
<?php the_search_query(); ?> value returned from search from
<?php the_permalink(); ?> url of post/page
<?php _e('Message'); ?> return translated text from translate()
<?php the_category(); ?> category of post/page
<?php wp_register(); ?> register link
<?php wp_register(); ?> register link
<?php the_author(); ?> author of post/page
<?php wp_loginout(); ?> login/logout link
<?php the_ID(); ?> id of post/page
<!--nextpage--> divide content into pages
<?php edit_post_link(); ?> edit link of post/page
<!--more--> cut off content and create link to full post
<?php wp_list_bookmarks(); ?> links from blogroll
<?php wp_meta(); ?> admin meta data
<?php comments_template(); ?> comment.php file contents
<?php timer_start(); ?> start page timer (header.php)
<?php wp_list_pages(); ?> list all pages
<?php timer_stop(1); ?> time to load the page (footer.php)
<?php wp_list_categories(); ?> list all categories
<?php echo get_num_queries(); ?> show queries executed to generate page
<?php next_post_link('%link'); ?> url to next post

<?php previous_post_list('%link'); ?> url to previous post

<?php get_calendar(); ?> show post calendar

<?php wp_get_archives(); ?> list of archive urls

<?php posts_nav_link(); ?> next and previous post link

<?php rewind_posts(); ?> rewinds post for a second loop

2014.3 ☺

You might also like