Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

home.php file

index.php will be use if this file is not created

<?php get_header(); ?>
  <div id=’main-content’>
  // paste content here
  </div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

index.php File

<?php get_header() ?>

<?php  // gets all post 
if (have_post()):
	while (have_posts()):
	the_post(); 
	the_content();
endwwhile;
endif;
?>

<?php get_sidebar() ?>
<?php get_footer() ?>

Prework

  1. change define(‘WP_DEBUG’, false); à define(‘WP_DEBUG’, true);  //in wp-config.php to see php or database errors
  2. create style.css and add comments. Used WP theme style.css for reference
  3. Add thumbnail for theme in theme folder
  4. create screenshot.png 1200px wide by 900px
  5. At the beginning of each file, always add a comment to indicate what the file is 
  6. <?php /* this is the header file*/ ?>      

Template files To Create

There are three (3) types of files

Page Templates

  • index.php – first page WP looks for
  • home.php– shows latest blog on home
  • front-page.php – used for static front page
  • single.php – individual post
  • archive.php – for post archives (all the post on your site)
  • category.php – used for post of specific categorty
  • tag.php – post of a specific tag
  • search.php
  • date.php
  • taxonomy.php
  • attachment.php
  • image.php
  • rtl.php
  • 404.php
  • Author.php

Template Partials:Specific part of a page get_header()

  • header.php
  • footer.php
  • sidebar.php
  • comments.php

Logic and Presentation

  • function.php
  • style.css




Widget in Footer

In the functions.php register a sidebar.

  register_sidebar(array (
        'name' => __ ('Footer Right', 'yourname'),	//chnage yourname to your theme name
        'id' => 'footer-right',	// change the footer id
        'decsription' => __('Widget added here will in the right section of the footer, Sevfolio'),
        'before widget' => '<section id=”%1$s” class=”widget %2$s”>',
        'after_widget'=> '<section>',
        'before_widget' => '<h2 class=’widget-title>',
        'after_title' => '</h2>'
    ));

In the footer.php file ad the sidebar

<?php dynamic-sidebar('footer-right'); ?>