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 Name | Description | |
---|
style.css | Style sheet file | |
index.php | Main page file | |
header.php | Header’s file | |
single.php | Post page’s file | |
archive.php | Archive’s file | |
searchform.php | Search form’s file | |
search.php | Search content’s file | |
404.php | 404 error page’s file | |
comments.php | Comment’s template file | |
footer.php | Footer’s file | |
sidebar.php | Sidebar’s file | |
page.php | Page’s file | |
front-page.php | Latest posts or static page’s file | |
tag.php | Display tags in archive format | |
category.php | Display categories in archive format | |
Function | Description | |
---|
<?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
Function | Description | |
---|
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
Function | Description | |
---|
<?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 | |
Function | Description | |
---|
/%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'); ?> | | |