WordPress Theme Cheat Sheet

 

To modify your WordPress theme, you need to memorize many codes, which can be frustrating. However, if you have a cheat sheet for minor changes when developing WordPress theme, you can do it much more easily. The following codes can provide a reference for you to help you easily edit your themes.

Basic Template files:

The following basic files should be available in every theme:

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

Header.php Codes:

The following codes are found in header.php and some of them are seen in template files. The codes like Location Site’s Theme Files are used for image URLs and the exact URL of the site code all over the template.

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

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

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

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

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

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

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

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

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

Other Template Files Codes:

To make your theme dynamic you can use the following coding, which will be seen across template files such as single.php, index.php, page.php and so on.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

These codes should help you to modify your WordPress theme quickly and easily!

Leave a Reply

Your email address will not be published. Required fields are marked *

Faceebook

ManageWp
Toronto WordPress Web Design - NYTO Group

WordPress Theme Cheat Sheet

by Tina time to read: 2 min
0