how to create theme

How to create WordPress theme

Skip to end of metadata

Go to start of metadata

Menu


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

Widget


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

Search


<?php get_search_form(); ?>
//searchform.php

User Registration


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

Featured Image


<?php
if ( has_post_thumbnail() ) {
 the_post_thumbnail(array(70,70));
}
?>
//
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


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

URL


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

Options


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

Condition


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

Page Hierarchy


Home Page display
 home.php
 index.php
Single Post display
 single-{post_type}.php - If the post type were product, WordPress would look for single-product.php.
 single.php
 index.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
 page.php
 index.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
 category.php
 archive.php
 index.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
 tag.php
 archive.php
 index.php
Search Result display
 search.php
 index.php
404 (Not Found) display
 404.php
 index.php

Some Impotent Widget


Archives

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

Categories

<?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'); ?>

Pages

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

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s