Tag Archives: Theme

How to customize your own WordPress Theme

Once you could write HTML and CSS website template, then you will be able to customize it to

WordPress Theme.

For to do that, there is some basic thing you need know:

1)Need understand WordPress Template Hierarchy, if you don’t knwo before, don’t scare.
Here is few template you must have in your theme folder.

Index.php //  main Theme templateindex.php
page.php //this is the static page template in wordpress
single.php //this is post page template
home.php // blog template
front-page.php//shown On front
archive.php// for archive page template
search.php// if you don’t have wordpree will use index.php

For more detail could go to http://codex.wordpress.org/Template_Hierarchy

2) WordPress cut page into pieces, so onece you have the html and css page, then slide it into
header.php, footer.php, sidebar.php(if you design have sidebar)

3)Here is the basic function you need it.
The path of style.css is: <?php bloginfo( ‘stylesheet_url’ ); ?>
The path of the theme folder: <?php bloginfo(‘template_directory’); ?>
<?php get_header();?> //this is for you get your header
<?php get_footer();?> // this is for you get your footer
<?php get_sidebar();?> //this is for you get your sidebar, if you have sidebar in your design

<?php if(have_posts()):while(have_posts()):the_post();?>
<?php endwhile; else:?>//this loop is very important,will be use for a lot of times when you

create a wordpress theme

In next post I will use a bootstrap Jumbotron template,here is the link http://getbootstrap.com/examples/jumbotron/  I will  customize it into wordpress theme

Customize WordPress Theme: Make header.php and footer.php — Part 2

<?php get_header();?>

<?php get_footer();?>

<?php get_sidebar();?>

Header.php meta change:

    <title><?php wp_title(”); ?><?php if(wp_title(”, false)) { echo ‘ | ‘; } ?> <?php bloginfo(‘name’); ?></title>    
    
    <meta http-equiv=”Content-Type” content=”text/html; charset=<?php bloginfo( ‘charset’ ); ?>” />

 

here is the why I said in the previous post why the categories is so important, in here you could use this in your header.php to pull out it as you navigation:

<?php
    $args=array(
      ‘orderby’ => ‘id’,
      ‘order’ => ‘ASC’
      );
    $categories=get_categories($args);
      foreach($categories as $category) {
        echo ‘<li class=”thisclass”><a href=”‘ . get_category_link( $category->term_id ) . ‘” title=”‘ . sprintf( __( “View all posts in %s” ), $category->name ) . ‘” ‘ . ‘>’ . $category->name.'</a></li>’;
        }
    ?>

 

Choosing Between Theme and StyleSheetTheme

Because properties of the StyleSheetTheme can be overridden by the page, and the Theme in turn can override these properties again, both serve a distinct purpose. You should set
the StyleSheetTheme if you want to supply default settings for your controls. That is, the StyleSheetTheme can supply defaults for your controls, which can then be overridden at the page
level. You should use the Theme property instead if you want to enforce the look and feel of your controls. Because the settings from the Theme cannot be overridden anymore and effectively overwrite any customizations, you can be assured that your controls look the way you defined them in the theme. There is one exception: by setting EnableTheming on the control to False you can disable theming for that control.