All PostsTipsWordPress

If you work in web development business or you are just a programmer, you know how many things you need to remember. Here comes so called cheat sheets that help you during the work process and lends you a hand on remembering all the syntax of the programming language. WordPress is not an exception here.

There is a lot of stuff that you need to have in mind, and if you forget it, you need it to search on the internet or elsewhere. It is one of the most popular CMS in the world and sure there is a lot of people who need help. Because of that, we have made a basic WordPress cheat sheet that you could use during development of the WP theme or while you improve the old one.

Here is the WordPress cheat sheet that we have made. Take a look and end writing that long code that you have been writing for so long.

Theme Structure

File NameDescription
style.cssStyle sheet file
index.phpMain page file
header.phpHeader’s file
single.phpPost page’s file
archive.phpArchive’s file
searchform.phpSearch form’s file
search.phpSearch content’s file
404.php404 error page’s file
comments.phpComment’s template file
footer.phpFooter’s file
sidebar.phpSidebar’s file
page.phpPage’s file
front-page.phpLatest posts or static page’s file
tag.phpDisplay tags in archive format
category.php                                  Display categories in archive format

Header Functions

FunctionDescription
<?php site_url(); ?>Url for website
<?php wp_title(); ?>Title of specific post
<?php bloginfo('name'); ?>Title of blog
<?php bloginfo('description'); ?>Description
<?php get_stylesheet_directory(); ?>Stylesheet folder location
<?php bloginfo('stylesheet_url'); ?>Style.css file location
<?php bloginfo('pingback_url'); ?>The pingback url
<?php bloginfo('template_url'); ?>Template’s folder destination
<?php bloginfo('version'); ?> Version of the WordPress
<?php bloginfo('atom_url'); ?>Atom url
<?php bloginfo('rss2_url'); ?>Rss2 url
<?php bloginfo('url'); ?>The address of the blog
<?php bloginfo('html_type'); ?>HTMLversion of the site
<?php bloginfo('charset'); ?>         Character parameters

BlogInfo Tags

FunctionDescription
is_home()                                        When the user is on the blog home page
is_front_page()When the user is on the home page
is_single()When the single post displayed
is_sticky()Check if a post is sticky
is_page()When a page is displayed
is_category()                                       When a category is displayed

WordPress Template Tags

FunctionDescription
<?php the_content(); ?>            Content of posts/pages
<?php if(have_posts()): ?>Check if there are posts
<?php while(have_posts()): the_post(); ?>Shows posts
<?php endwhile; ?>Closes loop
<?php endif; ?>Closes if
<?php get_header(); ?>Header.php file contents
<?php get_sidebar(); ?>Sidebar.php file contents
<?php get_footer(); ?>Footer.php file contents
<?php the_time('m-d-y'); ?>The date is ’08-18-07′
<?php comments_popup_link(); ?>Link to comments of post
<?php the_title(); ?>Title of post/page
<?php the_permalink(); ?>Url of post/page
<?php the_category(); ?>Category of post/page
<?php the_author(); ?>Author of post/page
<?php the_ID(); ?>Id of post/page
<?php edit_post_link(); ?>Edit link of post/page
<?php wp_list_bookmarks(); ?>Links from blogroll
<?php comments_template(); ?>Comment.php file contents
<?php wp_list_pages(); ?>List all pages
<?php wp_list_categories(); ?>List all categories
<?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

Extra Functions

FunctionDescription
/%postname%/                                         Custom permalinks
<?php include(TEMPLATEPATH . '/x'); ?>Include file from template folder
<?php the_search_query(); ?>Value returned from search from
<?php _e('Message'); ?>Return translated text from translate()
<?php wp_register(); ?>Registration link
<?php wp_loginout(); ?>Login/logout link
<!--nextpage-->Divide content into pages
<!--more-->Cut off content and make a link to full post
<?php wp_meta(); ?>Meta data
<?php timer_start(); ?>Start page timer
<?php timer_stop(1); ?>Time needed to load a page
<?php echo get_num_queries(); ?>Show queries executed to generate page

The Loop

Function
<?php if(have_posts()) { ?>
<?php while(have_posts()) { ?>
<?php the_post(); ?>
<?php // custom post content code for title, excerpt and featured image ?>
<?php get_stylesheet_directory(); ?>
<?php bloginfo('stylesheet_url'); ?>