Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WordPress Theme Cheat Sheet for Beginners

Last updated on by
Elegant Themes
WordPress Theme Cheat Sheet for Beginners

There are many codes to memorize just to modify a WordPress theme, so it helps to have a mini cheat sheet if you are looking to make minor changes or even developing your own theme. This is why we have decided to list a few codes that you can probably use for reference when editing themes. Bookmarking this page, or print this article and paste it on your desk.

Basic Template Files

Below is the list of basic files that every theme should have.

  • style.css
  • header.php
  • index.php
  • sidebar.php
  • footer.php
  • single.php
  • page.php
  • comments.php
  • 404.php
  • functions.php
  • archive.php
  • searchform.php
  • search.php

Codes in Header.php

These codes are mostly seen in header.php although some of these might be seen throughout your template files. Codes like Location of Site’s Theme Files are used to call for image URLs all over the template, same goes with the exact url of the site code. But most of these codes will be found in your header.php file.

<?php bloginfo('name'); ?> – Title of the Blog, or Blog Name

<?php wp_title(); ?> – Title of a Specific Page

<?php bloginfo('url'); ?> – Exact URL for the Site

<?php bloginfo('description'); ?> – Site’s Description

<?php bloginfo('template_url'); ?> – Location of Site’s Theme File

<?php bloginfo('stylesheet_url'); ?> – Link to the Style.css location

<?php bloginfo('rss2_url'); ?> – RSS Feed URL for the Site

<?php bloginfo('pingback_url'); ?> – Pingback URL for the site

<?php bloginfo('version'); ?> – WordPress Version Number

Codes for Other Template Files

Codes below will be seen across all template files such as single.php, index.php, page.php and so on. Its really easy to call on these codes to make your theme dynamic when coding it.

<?php get_header(); ?> – Displays Header.php file content

<?php get_footer(); ?> – Displays Footer.php file content

<?php get_sidebar(); ?> – Displays Sidebar.php file content

<?php comments_template(); ?> – Displays Comment.php file content

<?php the_content(); ?> – Displays the Content of the Post

<?php the_excerpt(); ?> – Displays the excerpt that is used in Posts

<?php the_title(); ?> – Title of the Specific Post

<?php the_permalink() ?> – Link of the Specific Post

<?php the_category(', ') ?> – Category of a Specific Post

<?php the_author(); ?> – Author of the Specific Post

<?php the_ID(); ?> – ID of a Specific Post

<?php edit_post_link(); ?> – Edit link for a Post

<?php next_post_link(' %link ') ?> – URL of the Next Page

<?php previous_post_link('%link') ?> – URL of the Previous Page

<?php get_links_list(); ?> – Lists all links in Blogroll

<?php wp_list_pages(); ?> – Lists all Pages

<?php wp_get_archives() ?> – List Archive for the Site

<?php wp_list_cats(); ?> – Lists all Categories

<?php get_calendar(); ?> – Displays the Built in Calendar

<?php wp_register(); ?> – Displays Register Link

<?php wp_loginout(); ?> – Displays Login/Logout Link only to Registered Users

Hopefully this has helped you guys. Please spread it around by sharing it with your friends. Bookmark this page to delicious and tweet it.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Shahbaz Ahmed Bhatti says:

    Very Nice and Goooood Work Keep it up, Very goood information for Basic

  2. Solomon says:

    Thanks very much, i really appreciate.

  3. Pali Madra says:

    Thanks for the great tutorial. I recommend the tutorial to anyone trying to learn WordPress.

    Keep up the good work!

  4. Ben says:

    Thanks for a very helpful article. Just want I have been looking for.

    Thanks.

    Ben

  5. madalinignisca says:

    what is – Site’s Description

    I think it is

  6. madalinignisca says:

    what is “<?php bloginfo(%u2019description%u2019); ?> – Site’s Description” ? I think it is “<?php bloginfo(‘description’); ?>”

  7. mirzayasir4 says:

    That’s great useful cheet sheet when you are doing editing in themes. Thanks

  8. John says:

    Fantastic, I’ve been looking for an easy WordPress cheatsheet for a while, thanks for doing this, makes life a lot easier and I can get a bit more creative. WordPress has such a lot of power under the hood.

  9. mark says:

    this is gr8 for beginner

  10. Russell Poulter says:

    This is SO bookmarked!

    Thanks.

  11. asif eminov says:

    Thanks this details.

  12. Ersatzknochen says:

    Yeah, very useful. Thank you.

  13. Delighted says:

    Thank you for the Codes in Header.php part, Very easy to understand and VERY useful! thank you for this.

  14. SleepY says:

    Wow….thats what i was looking for since days.

    thanks a lot !

  15. Victor Duwon Jackson says:

    This is great, Thanks.

  16. Manoj says:

    Great info! bookmarked :)

  17. Obed Ward says:

    Excellent WP theme cheat sheet, going to bookmark it (and of course tweet it). Thanks!

  18. Naeem Noor says:

    Very Useful, just printed it.

  19. Blog2Life says:

    These shortcodes are just what I was looking for to start work on some new themes.. thanks for the post and keep up the good work!

    • Hami says:

      Yes exactly. This post has solved out and let us (beginners) start working instantly on new ideas :D

  20. A.D.K. says:

    This is very useful thanks.

  21. Jon Rawlins says:

    Retweeted this for you. Just about to get a blog setup for myself, so this site has been very useful.

  22. Angad Sodhi says:

    Aah! Bookmarking this right away..
    Referring the default theme for these small details is now history!
    Thank you people.

  23. DaveK says:

    Cool, Thanks for sharing, consider it tweeted ;-)

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.