SlideShare a Scribd company logo
By Nile Flores
    @blondishnet
http://blondish.net
   Explain how to take an image like a PSD and
    convert it over to WordPress
   Cover whether you can use an existing
    framework, code with a Web page editor
    program or if it is best to code from scratch
   Reveal some tricks to making the process easier
Please note that we will assume that you already
know how PSD, HTML, and CSS. You are familiar
with how to at least translate a PSD over to HTML
and CSS.

You do not have to know HTML and CSS by heart
and you can use a web page editor program, but you
should learn enough code to do what is necessary
so you do not have to lean on a program as a crutch.
   If you have designed a theme in layers using PSD
    (or the equivalent in another graphic editor
    program), no layers should be merged
   Visualize how your theme will look
   Designate main areas in your theme with HTML
    elements as followed:
PSD to WordPress
PSD to WordPress
PSD to WordPress
PSD to WordPress
PSD to WordPress
PSD to WordPress
PSD to WordPress
Visualizing the technical structure of your
theme is extremely important. You cannot
even begin to code without knowing what
areas of your theme belong where,
especially code-wise.
<!-- Your DOC TYPE INFO -->
<html>
<head>
<title>YOUR SITE NAME</title>
<link rel="stylesheet" href="LINK TO YOUR STYLE SHEET" type="text/css"
   media="screen" />
</head>
<body>
<div id="header"></div>
<div id="menu"></div>
<div id="content"></div>
<div id="footer"></div>
</body>
</html>
<!-- Your DOC TYPE INFO -->
<html>
<head>
<title>YOUR SITE NAME</title>
<link rel="stylesheet" href="LINK TO YOUR STYLE SHEET" type="text/css"
   media="screen" />
<?php wp_head(); ?>
</head>
<body>
<div id="header"></div>
<div id="menu"> MENU CODE HERE</div>
<div id="content">THE WORDPRESS LOOP IN HERE</div>
<div id=“sidebar"> SIDEBAR CODE HERE</div>
<div id="footer"> FOOTER CODE HERE</div>
<?php wp_footer(); ?>
</body>
</html>
/wp-content
     /themes
            /yourthemename
                  /images
                  /js
                  file
                  file
                  file
                  etc…
• 404.php
• archives.php               Optional
• comments.php
• footer.php       • author.php
• functions.php    • category.php
• header.php       • content.php
• images.php       • content-single.php
• index.php        • content-gallery.php
• page.php         • tag.php
• search.php
• searchform.php
• single.php
• sidebar.php
• style.css
If you have pages and posts that need to be individually
themed, you can definitely theme them. Just name the template
with either of the following:

   page-{id}.php
   page-{slug}.php
   post-{id}.php

Label page template with:
<?php /* Template Name: Your Template Name */ ?>
Label post template with:
<?php /* Template Name Posts: Your Post Name or Even ID */
?>
http://codex.wordpress.org/Template_Hierarchy
http://codex.wordpress.org/The_Loop

This calls your content to a post, page or even
custom post type. Whatever you type in the
backend will populate where you put and
customized your loop.

It goes in theme files like your index.php,
single.php, and page.php- just to name a few.
<?php if (have_posts()) : ?>
   <?php while (have_posts()) : the_post(); ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<h2><a href="<?php the_permalink() ?>" rel="bookmark"
title="Permanent Link to <?php if ( function_exists('the_title_attribute'))
the_title_attribute(); else the_title(); ?>"><?php the_title();
?></a></h2>

<?php the_content('Read the rest of this entry &raquo;'); ?>
<?php endwhile; ?>

<div class="navigation">
        <?php if(!function_exists('wp_pagenavi')) : ?>
        <div class="alignleft"><?php next_posts_link('Previous')
?></div>
        <div class="alignright"><?php previous_posts_link('Next')
?></div>
        <?php else : wp_pagenavi(); endif; ?>
                </div>
<?php else : ?>
               <h2 class="center">Not Found</h2>
               <p class="center">Sorry, but you are looking for
something that isn't here.</p>
               <?php get_template_part('searchform'); // Navigation
bar (searchform.php) ?>

       <?php endif; ?>
   Meta info
<?php the_author() ?>
<?php the_time('m-d-Y') ?>
<?php the_category(', ') ?>
<?php the_tags(); ?>


   Link and number to post comments
<?php comments_popup_link(__('0 Comments', ‘yourthemename'),
__('1 Comment', ' yourthemename '), __('% Comments', '
yourthemename ')); ?>
This is normally the template that is for individual
posts and differs from the index.php because it
includes the php call to the WordPress comment
template.

<?php comments_template(); ?>
<?php if ( post_password_required() ) : ?>
       <?php
                       /* Stop the rest of comments.php from
being processed,
                        * but don't kill the script entirely -- we still
have
                        * to fully load the template.
                        */
                       return;
              endif;
       ?>
<!-- You can start editing here. -->
<?php if ($comments) : ?>
          <h2 id="comments">Comments <?php comments_number('(0)',
'(1)', '(%)' );?></h2>
   <div class="commentlist">
<ol>
          <?php wp_list_comments(); ?>
</ol>
          </div>
 <?php else : // this is displayed if there are no comments so far ?>
          <?php if ('open' == $post->comment_status) : ?>
                   <!-- If comments are open, but there are no comments. --
>
          <?php else : // comments are closed ?>
                   <!-- If comments are closed. -->
                   <p class="nocomments">Comments are closed.</p>
          <?php endif; ?>
<?php endif; ?>
<div class="navigation">
  <?php paginate_comments_links(); ?>
 </div>
<?php if ('open' == $post->comment_status) : ?>
<div class="respond">
<h3 id="respond_title">Write a comment</h3>
<div class="cancel-comment-reply">
         <small><?php cancel_comment_reply_link(); ?></small>
</div>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-
login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a>
to post a comment.</p>
<?php else : ?>
<?php comment_form(); ?>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // if you delete this the sky will fall on your head ?>
The functions.php file acts much like a plugin to give
your theme dynamic functionality. It is theme
specific, meaning if you change to a different theme
and the functions are different, then you will lose
that functionality unless you put that same code in
the new theme.
<?php
  // all functions will go here
?>
   Add Custom Menu(s)
// Register menus
if ( function_exists( 'register_nav_menus' ) ) {
    register_nav_menus( array(
        'primary' => __( 'Primary Navigation' ),
        'secondary' => __( 'Secondary Navigation' )
    ));
}
   Add Sidebar
// Register sidebar
if ( function_exists('register_sidebar') )
register_sidebar(array(
                   'name' => 'Sidebar',
'description' => 'This is the primary sidebar.',
                   'before_widget' => '<li id="%1$s" class="widget
%2$s">',
         'after_widget' => '</li>',
         'before_title' => '<h2 class="widgettitle">',
         'after_title' => '</h2>',
         ));
   Text Domain
// Text domain
load_theme_textdomain(‘yourthemenamehere');
   Content Width
// Specific Content Width
if ( ! isset( $content_width ) )
          $content_width = 625;
   Feed Support
// Add default posts and comments RSS feed links to <head>.
        add_theme_support( 'automatic-feed-links' );
You can consult the Functions Reference in the
Codex for more awesome functions.
http://codex.wordpress.org/Function_Reference
Your functions.php is, as I said earlier something
theme specific. Plugins can work across themes.

It is your decision on what you want to be theme
specific, but ALWAYS remember that if you change
your theme and wonder why you are missing a
dynamic function… well, go back to the previous
functions.php and get the code.

Otherwise put together a plugin to retain
functionality from theme to theme.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" <?php
language_attributes(); ?>>

<head profile="http://gmpg.org/xfn/11">

<meta http-equiv="Content-Type" content="<?php
bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php
         /*
          * Print the <title> tag based on what is being viewed.
          */
         global $page, $paged;
         wp_title( '|', true, 'right' );
         // Add the blog name.
         bloginfo( 'name' );
         // Add the blog description for the home/front page.
         $site_description = get_bloginfo( 'description', 'display' );
         if ( $site_description && ( is_home() || is_front_page() ) )
                    echo " | $site_description";
         // Add a page number if necessary:
         if ( $paged >= 2 || $page >= 2 )
                    echo ' | ' . sprintf( __( 'Page %s', 'darkdream' ), max( $paged,
$page ) );
         ?></title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>"
type="text/css" media="screen" />

<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>

<?php wp_head(); ?>

</head>

<body <?php body_class(); ?>>
Some people include in their header.php all code up
to where the content itself begins. It is up to you on
how you want to document and organize your code.

Keep in mind that if you are designing for a client or
that your theme will be handled by another
developer, that you try to make your code fairly easy
to decipher.

The wp_head call MUST be in your header.php
before the ending head tag in your theme template.
To call the header.php file from an individual
template file like index.php, page.php, single.php,
etc, the general php call for the header is fine-

<?php get_header(); ?>
Of course, this is where you will beautify your
theme. You can change the typography, the colors,
and anything to your hearts wish. Just make sure to
document each area for easier developing later on.
Make sure your style.css starts with the following
whether you are designing for a client or for a free
theme to give out in the WordPress Theme
Repository.
/*
Theme Name: Your Theme Name
Theme URI: Link to Example Theme
Description: Brief Theme Description
Version: 1.0
Author: Your Name
Author URI: Your Link
Tags: two-columns, blue, pink, gray, threaded-comments, full-
width-template, custom-menu

License: GPL
License URI: http://www.gnu.org/licenses/gpl-2.0.html

*/
In your sidebar.php, you need to put a code to call
what you put in your widgets.
<ul>
   <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar() )
: ?>
   <li>Static Content</li>
   <?php endif; ?>
</ul>

The static content is if you want to add your own coding
that will not be controlled by the custom widgets in the
WordPress backend.
To call the sidebar.php file from an individual template file like
index.php, page.php, single.php, or even within the footer
(wherever you want your widgets to be), the default sidebar
would be called to the page as-

<?php get_sidebar(); ?>

Other sidebar widgets can be called like-

<?php /* A sidebar in the footer? Yep. You can can customize
 * your footer with three columns of widgets.
 */
if ( ! is_404() ) get_sidebar( 'footer' ); ?>
Remember when we put covered the Functions.php
of your theme? Well, this is an example of how to
call that custom menu to wherever you put it in your
theme.

<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu
falls back to wp_page_menu. The menu assiged to the primary
position is the one used. If none is assigned, the menu with the lowest
ID is used. */ ?>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
This is used for your theme’s search when you call it to
your theme’s template

<form method="get" id="searchform" action="<?php echo home_url();
?>/">
<div><input type="text" value="<?php the_search_query(); ?>"
name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
To call the search form in your searchform.php,
place the follow call to your theme template
wherever you wish your search form to display-

<?php get_template_part('searchform'); // Navigation bar
(searchform.php) ?>
   404.php
   Archives.php
   Image.php
   Author.php
<?php wp_footer(); ?>
</body>
</html>


The footer file can contain footer widgets or
whatever you like. The wp_footer php call must be
in the footer before the ending body tag in your
theme template.
To call the footer.php file from an individual template
file like index.php, page.php, single.php, etc, the
general php call for the footer is fine-

<?php get_footer(); ?>
   Theme Development -
    http://codex.wordpress.org/Theme_Development
   Digging Into WordPress - http://digwp.com/
   WPRecipes.com
   WPBeginner.com
   JustinTadlock.com
   WPCandy.com
   WPHacks.com
   Blondish.net
Nile Flores
Site: http://blondish.net
Twitter: @blondishnet
Facebook: http://fb.com/NileFlores
SlideShare: http://slideshare.net/blondishnet

More Related Content

PDF
How to create a basic template
PPTX
Build a WordPress theme from HTML5 template @ Telerik
PPTX
Building Potent WordPress Websites
PPTX
Childthemes ottawa-word camp-1919
DOC
Wordpress(css,php,js,ajax)
PDF
Mobile themes, QR codes, and shortURLs
PDF
HTML 5 Step By Step - Ebook
PDF
How to make a WordPress theme
How to create a basic template
Build a WordPress theme from HTML5 template @ Telerik
Building Potent WordPress Websites
Childthemes ottawa-word camp-1919
Wordpress(css,php,js,ajax)
Mobile themes, QR codes, and shortURLs
HTML 5 Step By Step - Ebook
How to make a WordPress theme

What's hot (19)

PDF
Laravel 로 배우는 서버사이드 #5
DOC
Templates81 special document
DOC
Templates81 special document
PPTX
The Way to Theme Enlightenment 2017
PDF
Grok Drupal (7) Theming
KEY
HTML CSS & Javascript
PDF
Arizona WP - Building a WordPress Theme
PDF
OSDC 2009 Rails Turtorial
PPTX
Introduction to html 5
PPT
Wordpress & HTML5 by Rob Larsen
PPTX
Twitter bootstrap
ODP
Drupal Theme Development - DrupalCon Chicago 2011
PDF
integrasi template admin lte terbaru dengan laravel 7
PPTX
Essential html tweaks for accessible themes
PDF
HTML5 Essentials
PDF
jQuery UI and Plugins
PDF
An Introduction To HTML5
PDF
Intro to html 5
PPTX
Css, xhtml, javascript
Laravel 로 배우는 서버사이드 #5
Templates81 special document
Templates81 special document
The Way to Theme Enlightenment 2017
Grok Drupal (7) Theming
HTML CSS & Javascript
Arizona WP - Building a WordPress Theme
OSDC 2009 Rails Turtorial
Introduction to html 5
Wordpress & HTML5 by Rob Larsen
Twitter bootstrap
Drupal Theme Development - DrupalCon Chicago 2011
integrasi template admin lte terbaru dengan laravel 7
Essential html tweaks for accessible themes
HTML5 Essentials
jQuery UI and Plugins
An Introduction To HTML5
Intro to html 5
Css, xhtml, javascript
Ad

Similar to PSD to WordPress (20)

DOC
20110820 header new style
KEY
Word Camp Fukuoka2010
PPTX
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
PDF
Theming 101
PDF
Word press templates
PDF
Introduction to WordPress Theme Development
PPTX
The Way to Theme Enlightenment
PDF
Grok Drupal (7) Theming - 2011 Feb update
PDF
Builing a WordPress Theme
PDF
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
PPTX
WordPress and PHP - It Takes One to Know One
PDF
WordPress Theme Workshop: Part 3
PDF
Agile Wordpress
PDF
[Bristol WordPress] Supercharging WordPress Development
PPTX
crtical points for customizing Joomla templates
PDF
WordPress Theme Workshop: Part 4
PDF
How does get template part works in twenty ten theme
PDF
Intro to WordPress Plugin Development
PPT
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
PDF
D7 theming what's new - London
20110820 header new style
Word Camp Fukuoka2010
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
Theming 101
Word press templates
Introduction to WordPress Theme Development
The Way to Theme Enlightenment
Grok Drupal (7) Theming - 2011 Feb update
Builing a WordPress Theme
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
WordPress and PHP - It Takes One to Know One
WordPress Theme Workshop: Part 3
Agile Wordpress
[Bristol WordPress] Supercharging WordPress Development
crtical points for customizing Joomla templates
WordPress Theme Workshop: Part 4
How does get template part works in twenty ten theme
Intro to WordPress Plugin Development
Hardcore URL Routing for WordPress - WordCamp Atlanta 2014 (PPT)
D7 theming what's new - London
Ad

More from Nile Flores (20)

PDF
Practical SEO for WordPress Bloggers
PDF
Introduction to Optimizing WordPress for Website Speed
PDF
Introduction to WordPress Security
PDF
Make Money with WordPress for Bloggers
PDF
Social Media 101 for WordPress
PDF
Google Quality Guidelines 101 for WordPress Bloggers
PDF
Creating a WordPress Website that Works from the Start
PDF
How to Make the Most out of Yoast SEO
PDF
Teaching Your Clients How to Use WordPress
PDF
Introduction to Optimizing WordPress for Website Speed
PDF
Introduction to WordPress Security
PDF
Troubleshooting WordPress
PDF
How You Can Contribute to WordPress
PDF
Making Money Using WordPress
PDF
Basic Plugin Recommendations to get your WordPress Website Started
PDF
Podcasting for WordPress
PDF
WordPress SEO: Getting Back to the Basics
PDF
How Blogging Can Benefit Your Business
PDF
WordPress Custom Post Types
PPTX
Typography for WordPress
Practical SEO for WordPress Bloggers
Introduction to Optimizing WordPress for Website Speed
Introduction to WordPress Security
Make Money with WordPress for Bloggers
Social Media 101 for WordPress
Google Quality Guidelines 101 for WordPress Bloggers
Creating a WordPress Website that Works from the Start
How to Make the Most out of Yoast SEO
Teaching Your Clients How to Use WordPress
Introduction to Optimizing WordPress for Website Speed
Introduction to WordPress Security
Troubleshooting WordPress
How You Can Contribute to WordPress
Making Money Using WordPress
Basic Plugin Recommendations to get your WordPress Website Started
Podcasting for WordPress
WordPress SEO: Getting Back to the Basics
How Blogging Can Benefit Your Business
WordPress Custom Post Types
Typography for WordPress

Recently uploaded (20)

PDF
JUDICIAL_ACTIVISM_CRITICAL_ANALYSIS in india.pdf
PDF
Conflict, Narrative and Media -An Analysis of News on Israel-Palestine Confli...
PDF
Regional Media Representation of Kuki-Meitei Conflict - An Analysis of Peace ...
PPTX
Bridging Horizons_ Indo-Thai Cultural and Tourism Synergy in a Competitive Asia.
DOC
证书结业SU毕业证,莫道克大学毕业证假学位证
PPTX
ASEANOPOL: The Multinational Police Force
PPTX
200 years old story of a paradise on earth
PDF
The Blogs_ Hamas’s Deflection Playbook _ Andy Blumenthal _ The Times of Israe...
PPTX
Sir Creek Conflict: History and its importance
PDF
Role of federalism in the indian society
PPTX
PPT on SardarPatel and Popular Media.pptx
PPTX
OBG. ABNORAMLTIES OF THE PUERPERIUM, BSC
PDF
Executive an important link between the legislative and people
PPTX
Precised New Precis and Composition 2025.pptx
PPTX
opher bryers alert -How Opher Bryer’s Impro.ai Became the Center of Israel’s ...
PDF
Mathura Sridharan's Appointment as Ohio Solicitor General Sparks Racist Backl...
PDF
Supereme Court history functions and reach.pdf
PDF
KAL 007 Manual: The Russian Shootdoown of Civilian Plane on 09/01/1983
PDF
Theories of federalism showcasing india .pdf
PDF
The Most Dynamic Lawyer to Watch 2025.pdf
JUDICIAL_ACTIVISM_CRITICAL_ANALYSIS in india.pdf
Conflict, Narrative and Media -An Analysis of News on Israel-Palestine Confli...
Regional Media Representation of Kuki-Meitei Conflict - An Analysis of Peace ...
Bridging Horizons_ Indo-Thai Cultural and Tourism Synergy in a Competitive Asia.
证书结业SU毕业证,莫道克大学毕业证假学位证
ASEANOPOL: The Multinational Police Force
200 years old story of a paradise on earth
The Blogs_ Hamas’s Deflection Playbook _ Andy Blumenthal _ The Times of Israe...
Sir Creek Conflict: History and its importance
Role of federalism in the indian society
PPT on SardarPatel and Popular Media.pptx
OBG. ABNORAMLTIES OF THE PUERPERIUM, BSC
Executive an important link between the legislative and people
Precised New Precis and Composition 2025.pptx
opher bryers alert -How Opher Bryer’s Impro.ai Became the Center of Israel’s ...
Mathura Sridharan's Appointment as Ohio Solicitor General Sparks Racist Backl...
Supereme Court history functions and reach.pdf
KAL 007 Manual: The Russian Shootdoown of Civilian Plane on 09/01/1983
Theories of federalism showcasing india .pdf
The Most Dynamic Lawyer to Watch 2025.pdf

PSD to WordPress

  • 1. By Nile Flores @blondishnet http://blondish.net
  • 2. Explain how to take an image like a PSD and convert it over to WordPress  Cover whether you can use an existing framework, code with a Web page editor program or if it is best to code from scratch  Reveal some tricks to making the process easier
  • 3. Please note that we will assume that you already know how PSD, HTML, and CSS. You are familiar with how to at least translate a PSD over to HTML and CSS. You do not have to know HTML and CSS by heart and you can use a web page editor program, but you should learn enough code to do what is necessary so you do not have to lean on a program as a crutch.
  • 4. If you have designed a theme in layers using PSD (or the equivalent in another graphic editor program), no layers should be merged  Visualize how your theme will look  Designate main areas in your theme with HTML elements as followed:
  • 12. Visualizing the technical structure of your theme is extremely important. You cannot even begin to code without knowing what areas of your theme belong where, especially code-wise.
  • 13. <!-- Your DOC TYPE INFO --> <html> <head> <title>YOUR SITE NAME</title> <link rel="stylesheet" href="LINK TO YOUR STYLE SHEET" type="text/css" media="screen" /> </head> <body> <div id="header"></div> <div id="menu"></div> <div id="content"></div> <div id="footer"></div> </body> </html>
  • 14. <!-- Your DOC TYPE INFO --> <html> <head> <title>YOUR SITE NAME</title> <link rel="stylesheet" href="LINK TO YOUR STYLE SHEET" type="text/css" media="screen" /> <?php wp_head(); ?> </head> <body> <div id="header"></div> <div id="menu"> MENU CODE HERE</div> <div id="content">THE WORDPRESS LOOP IN HERE</div> <div id=“sidebar"> SIDEBAR CODE HERE</div> <div id="footer"> FOOTER CODE HERE</div> <?php wp_footer(); ?> </body> </html>
  • 15. /wp-content /themes /yourthemename /images /js file file file etc…
  • 16. • 404.php • archives.php Optional • comments.php • footer.php • author.php • functions.php • category.php • header.php • content.php • images.php • content-single.php • index.php • content-gallery.php • page.php • tag.php • search.php • searchform.php • single.php • sidebar.php • style.css
  • 17. If you have pages and posts that need to be individually themed, you can definitely theme them. Just name the template with either of the following:  page-{id}.php  page-{slug}.php  post-{id}.php Label page template with: <?php /* Template Name: Your Template Name */ ?> Label post template with: <?php /* Template Name Posts: Your Post Name or Even ID */ ?> http://codex.wordpress.org/Template_Hierarchy
  • 18. http://codex.wordpress.org/The_Loop This calls your content to a post, page or even custom post type. Whatever you type in the backend will populate where you put and customized your loop. It goes in theme files like your index.php, single.php, and page.php- just to name a few.
  • 19. <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php if ( function_exists('the_title_attribute')) the_title_attribute(); else the_title(); ?>"><?php the_title(); ?></a></h2> <?php the_content('Read the rest of this entry &raquo;'); ?>
  • 20. <?php endwhile; ?> <div class="navigation"> <?php if(!function_exists('wp_pagenavi')) : ?> <div class="alignleft"><?php next_posts_link('Previous') ?></div> <div class="alignright"><?php previous_posts_link('Next') ?></div> <?php else : wp_pagenavi(); endif; ?> </div>
  • 21. <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php get_template_part('searchform'); // Navigation bar (searchform.php) ?> <?php endif; ?>
  • 22. Meta info <?php the_author() ?> <?php the_time('m-d-Y') ?> <?php the_category(', ') ?> <?php the_tags(); ?>  Link and number to post comments <?php comments_popup_link(__('0 Comments', ‘yourthemename'), __('1 Comment', ' yourthemename '), __('% Comments', ' yourthemename ')); ?>
  • 23. This is normally the template that is for individual posts and differs from the index.php because it includes the php call to the WordPress comment template. <?php comments_template(); ?>
  • 24. <?php if ( post_password_required() ) : ?> <?php /* Stop the rest of comments.php from being processed, * but don't kill the script entirely -- we still have * to fully load the template. */ return; endif; ?> <!-- You can start editing here. -->
  • 25. <?php if ($comments) : ?> <h2 id="comments">Comments <?php comments_number('(0)', '(1)', '(%)' );?></h2> <div class="commentlist"> <ol> <?php wp_list_comments(); ?> </ol> </div> <?php else : // this is displayed if there are no comments so far ?> <?php if ('open' == $post->comment_status) : ?> <!-- If comments are open, but there are no comments. -- > <?php else : // comments are closed ?> <!-- If comments are closed. --> <p class="nocomments">Comments are closed.</p> <?php endif; ?> <?php endif; ?>
  • 26. <div class="navigation"> <?php paginate_comments_links(); ?> </div> <?php if ('open' == $post->comment_status) : ?> <div class="respond"> <h3 id="respond_title">Write a comment</h3> <div class="cancel-comment-reply"> <small><?php cancel_comment_reply_link(); ?></small> </div> <?php if ( get_option('comment_registration') && !$user_ID ) : ?> <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp- login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p> <?php else : ?> <?php comment_form(); ?> <?php endif; // If registration required and not logged in ?> </div> <?php endif; // if you delete this the sky will fall on your head ?>
  • 27. The functions.php file acts much like a plugin to give your theme dynamic functionality. It is theme specific, meaning if you change to a different theme and the functions are different, then you will lose that functionality unless you put that same code in the new theme.
  • 28. <?php // all functions will go here ?>
  • 29. Add Custom Menu(s) // Register menus if ( function_exists( 'register_nav_menus' ) ) { register_nav_menus( array( 'primary' => __( 'Primary Navigation' ), 'secondary' => __( 'Secondary Navigation' ) )); }
  • 30. Add Sidebar // Register sidebar if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Sidebar', 'description' => 'This is the primary sidebar.', 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>', ));
  • 31. Text Domain // Text domain load_theme_textdomain(‘yourthemenamehere');  Content Width // Specific Content Width if ( ! isset( $content_width ) ) $content_width = 625;  Feed Support // Add default posts and comments RSS feed links to <head>. add_theme_support( 'automatic-feed-links' );
  • 32. You can consult the Functions Reference in the Codex for more awesome functions. http://codex.wordpress.org/Function_Reference
  • 33. Your functions.php is, as I said earlier something theme specific. Plugins can work across themes. It is your decision on what you want to be theme specific, but ALWAYS remember that if you change your theme and wonder why you are missing a dynamic function… well, go back to the previous functions.php and get the code. Otherwise put together a plugin to retain functionality from theme to theme.
  • 34. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
  • 35. <title><?php /* * Print the <title> tag based on what is being viewed. */ global $page, $paged; wp_title( '|', true, 'right' ); // Add the blog name. bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'darkdream' ), max( $paged, $page ) ); ?></title>
  • 36. <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> <?php wp_head(); ?> </head> <body <?php body_class(); ?>>
  • 37. Some people include in their header.php all code up to where the content itself begins. It is up to you on how you want to document and organize your code. Keep in mind that if you are designing for a client or that your theme will be handled by another developer, that you try to make your code fairly easy to decipher. The wp_head call MUST be in your header.php before the ending head tag in your theme template.
  • 38. To call the header.php file from an individual template file like index.php, page.php, single.php, etc, the general php call for the header is fine- <?php get_header(); ?>
  • 39. Of course, this is where you will beautify your theme. You can change the typography, the colors, and anything to your hearts wish. Just make sure to document each area for easier developing later on.
  • 40. Make sure your style.css starts with the following whether you are designing for a client or for a free theme to give out in the WordPress Theme Repository.
  • 41. /* Theme Name: Your Theme Name Theme URI: Link to Example Theme Description: Brief Theme Description Version: 1.0 Author: Your Name Author URI: Your Link Tags: two-columns, blue, pink, gray, threaded-comments, full- width-template, custom-menu License: GPL License URI: http://www.gnu.org/licenses/gpl-2.0.html */
  • 42. In your sidebar.php, you need to put a code to call what you put in your widgets. <ul> <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?> <li>Static Content</li> <?php endif; ?> </ul> The static content is if you want to add your own coding that will not be controlled by the custom widgets in the WordPress backend.
  • 43. To call the sidebar.php file from an individual template file like index.php, page.php, single.php, or even within the footer (wherever you want your widgets to be), the default sidebar would be called to the page as- <?php get_sidebar(); ?> Other sidebar widgets can be called like- <?php /* A sidebar in the footer? Yep. You can can customize * your footer with three columns of widgets. */ if ( ! is_404() ) get_sidebar( 'footer' ); ?>
  • 44. Remember when we put covered the Functions.php of your theme? Well, this is an example of how to call that custom menu to wherever you put it in your theme. <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?> <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
  • 45. This is used for your theme’s search when you call it to your theme’s template <form method="get" id="searchform" action="<?php echo home_url(); ?>/"> <div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" /> <input type="submit" id="searchsubmit" value="Search" /> </div> </form>
  • 46. To call the search form in your searchform.php, place the follow call to your theme template wherever you wish your search form to display- <?php get_template_part('searchform'); // Navigation bar (searchform.php) ?>
  • 47. 404.php  Archives.php  Image.php  Author.php
  • 48. <?php wp_footer(); ?> </body> </html> The footer file can contain footer widgets or whatever you like. The wp_footer php call must be in the footer before the ending body tag in your theme template.
  • 49. To call the footer.php file from an individual template file like index.php, page.php, single.php, etc, the general php call for the footer is fine- <?php get_footer(); ?>
  • 50. Theme Development - http://codex.wordpress.org/Theme_Development  Digging Into WordPress - http://digwp.com/  WPRecipes.com  WPBeginner.com  JustinTadlock.com  WPCandy.com  WPHacks.com  Blondish.net
  • 51. Nile Flores Site: http://blondish.net Twitter: @blondishnet Facebook: http://fb.com/NileFlores SlideShare: http://slideshare.net/blondishnet