Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Understanding WordPress Themes Daisy Olsen http://wpmama.com @DaisyOlsen
Stylesheet Heading /* Theme Name: Origins Theme Theme URI: http://wpmama.com/origins-theme Description: A blank theme Vers...
Importing other Stylesheets @import url(css/reset.css);
The Simplest Index.php file <?php get_header();  if (have_posts()) :  while (have_posts()) : the_post(); the_content();  e...
“ The Loop” <?php if (have_posts()) :  while (have_posts()) : the_post(); ?> Stuff to display for each Post <?php endwhile...
Extending Your Theme <ul><li>Template Files
Include Tags
Template Tags
API Hooks
Filter Hooks </li></ul>
Include Tags Used within a Template file to execute code found in another template file <ul><li>get_header(); /* header.ph...
get_footer(); /* footer.php */
get_sidebar(); /* sidebar.php */
get_search_form();  /*searchform.php*/
Upcoming SlideShare
Loading in …5
×

Creating Themes

4,898 views

Published on

WordPress Theme Basics. Presented by Daisy Olsen at WordCamp NYC on November 14, 2009.

Published in: Technology, Business
  • Be the first to comment

Creating Themes

  1. 1. Understanding WordPress Themes Daisy Olsen http://wpmama.com @DaisyOlsen
  2. 2. Stylesheet Heading /* Theme Name: Origins Theme Theme URI: http://wpmama.com/origins-theme Description: A blank theme Version: 1.0 Author: Daisy Olsen Author URI: http://wpmama.com/ Template: origins (for use when creating a child theme) Tags: blank, empty, minimal */
  3. 3. Importing other Stylesheets @import url(css/reset.css);
  4. 4. The Simplest Index.php file <?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; Endif; get_sidebar(); get_footer(); ?>
  5. 5. “ The Loop” <?php if (have_posts()) : while (have_posts()) : the_post(); ?> Stuff to display for each Post <?php endwhile; ?> <?php else : ?> Stuff to display if no posts are returned by the have_posts() function <?php endif; ?>
  6. 6. Extending Your Theme <ul><li>Template Files
  7. 7. Include Tags
  8. 8. Template Tags
  9. 9. API Hooks
  10. 10. Filter Hooks </li></ul>
  11. 11. Include Tags Used within a Template file to execute code found in another template file <ul><li>get_header(); /* header.php */
  12. 12. get_footer(); /* footer.php */
  13. 13. get_sidebar(); /* sidebar.php */
  14. 14. get_search_form(); /*searchform.php*/
  15. 15. comments_template(); /*coments.php */
  16. 16. Include( TEMPLATEPATH . '/header2.php');
  17. 17. Include( STYLESHEETPATH . '/header2.php'); </li></ul>
  18. 18. Template Files <ul><li>style.css
  19. 19. index.php
  20. 20. header.php
  21. 21. footer.php
  22. 22. sidebar.php
  23. 23. comments.php
  24. 24. functions.php </li></ul><ul><li>archive.php
  25. 25. single.php
  26. 26. page.php
  27. 27. search.php
  28. 28. searchform.php
  29. 29. 404.php
  30. 30. Page Templates </li></ul>
  31. 31. Template Tags <ul><li>An instruction for WordPress to “do” or “get” something
  32. 32. Parameters can be passed in template tags
  33. 33. A Basic Template Tag Function </li></ul><?php the_content(); ?> <ul><li>With the $more_link_text parameter set </li></ul><?php the_content('Read more...'); ?>
  34. 34. Basic API Hooks <ul><ul><ul><li>Placed inside the <head> element of the theme. Usually in header.php </li></ul></ul><li>wp_head (); </li><ul><ul><li>Placed inside the <head> element of the theme. Usually in header.php </li></ul></ul><li>wp_footer(); </li><ul><ul><li>Place at the bottom of the theme. Usually in footer.php </li></ul></ul><li>comment_form(); </li></ul>
  35. 35. Filter Hook – Modify Core Function Behavior <ul>Filtering the More Link (Thanks to Justin Tadlock) </ul>add_filter( 'the_content_more_link', 'my_more_link', 10, 2 ); function my_more_link( $more_link, $more_link_text ) { return str_replace( $more_link_text, 'Continue reading &rarr;', $more_link ); }
  36. 36. Functions.php <ul><li>Sidebars are Registered in this file
  37. 37. Additional code placed here
  38. 38. Can extend functionality of a theme to include anything that a plugin can do. </li></ul>
  39. 39. Look at a Working Theme
  40. 40. Questions? Daisy Olsen wpmama.com @DaisyOlsen

×