how to create theme

How to create WordPress theme

Skip to end of metadata

Go to start of metadata


 wp_nav_menu(array('menu' => 'footer_menu', 'menu_id' => 'navigation_id', 'menu_class'=>'navigation_class', 'container' => false, 'link_before' => '<span>', 'link_after' => '</span>'));


<?php if ( is_active_sidebar( 'secondary-widget-area' ) ) : ?>
 <?php dynamic_sidebar( 'secondary-widget-area' ); ?>
<?php endif; ?>


<?php get_search_form(); ?>

User Registration

 <?php wp_register(); ?>
 <li><?php wp_loginout(); ?></li>

Featured Image

if ( has_post_thumbnail() ) {
the_post_thumbnail(); // without parameter -> Thumbnail
the_post_thumbnail('thumbnail'); // Thumbnail (default 150px x 150px max)
the_post_thumbnail('medium'); // Medium resolution (default 300px x 300px max)
the_post_thumbnail('large'); // Large resolution (default 640px x 640px max)
the_post_thumbnail('full'); // Full resolution (original size uploaded)
the_post_thumbnail( array(100,100) ); // Other resolutions

Display Single Post Contents

 $post_id = 16;
 $queried_post = get_post($post_id);
 echo $queried_post->post_content;


<?php echo get_template_directory_uri(); ?>
<?php echo home_url(); ?>


<?php echo get_option('blogname'); ?>
<?php $admin_email = get_option('admin_email'); ?>


1. is_home()
2. is_front_page()
3. is_category()
4. is_tag()

Page Hierarchy

Home Page display
Single Post display
 single-{post_type}.php - If the post type were product, WordPress would look for single-product.php.
Page display
 page-{slug}.php - If the page slug is recent-news, WordPress will look to use page-recent-news.php
 page-{id}.php - If the page ID is 6, WordPress will look to use page-6.php
Category display
 category-{slug}.php - If the category's slug were news, WordPress would look for category-news.php
 category-{id}.php - If the category's ID were 6, WordPress would look for category-6.php
Tag display
 tag-{slug}.php - If the tag's slug were sometag, WordPress would look for tag-sometag.php
 tag-{id}.php - If the tag's ID were 6, WordPress would look for tag-6.php
Search Result display
404 (Not Found) display

Some Impotent Widget


<?php wp_get_archives('type=monthly'); ?>


<?php wp_list_categories(array('show_count' => true, 'title_li' => null,'exclude' => 1)); ?>
<?php wp_list_categories('title_li=<h2>Categories</h2>'); ?>

Tag cloud

<?php wp_tag_cloud('smallest=9&largest=18'); ?>
<?php wp_tag_cloud('smallest=9&largest=22&unit=pt&number=200&format=flat&orderby=name&order=ASC');?>
<?php wp_list_bookmarks('title_li=&categorize=0&orderby=id'); ?>


<?php wp_list_pages('title_li='); ?>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s