Creating Themes

Embed Size (px)

DESCRIPTION

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

Citation preview

  • 1. Understanding WordPress Themes Daisy Olsen http://wpmama.com @DaisyOlsen

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. Importing other Stylesheets @import url(css/reset.css); 4. The Simplest Index.php file 5. The Loop Stuff to display for each Post Stuff to display if no posts are returned by the have_posts() function 6. Extending Your Theme

  • Template Files

7. Include Tags 8. Template Tags 9. API Hooks 10. Filter Hooks 11. Include Tags Used within a Template file to execute code found in another template file

  • get_header(); /* header.php */

12. get_footer(); /* footer.php */ 13. get_sidebar(); /* sidebar.php */ 14. get_search_form();/*searchform.php*/ 15. comments_template();/*coments.php */ 16. Include( TEMPLATEPATH . '/header2.php'); 17. Include( STYLESHEETPATH . '/header2.php'); 18. Template Files

  • style.css

19. index.php 20. header.php 21. footer.php 22. sidebar.php 23. comments.php 24. functions.php

  • archive.php

25. single.php 26. page.php 27. search.php 28. searchform.php 29. 404.php 30. Page Templates 31. Template Tags

  • An instruction for WordPress to do or get something

32. Parameters can be passed in template tags 33. A Basic Template Tag Function

  • With the $more_link_text parameter set

34. Basic API Hooks

      • Placed inside the element of the theme. Usually in header.php

wp_head ();

    • Placed inside the element of the theme. Usually in header.php

wp_footer();

    • Place at the bottom of the theme. Usually in footer.php

comment_form(); 35. Filter Hook Modify Core Function Behavior

  • Filtering the More Link(Thanks to Justin Tadlock)

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 ', $more_link ); } 36. Functions.php

  • Sidebars are Registered in this file

37. Additional code placed here 38. Can extend functionality of a theme to include anything that a plugin can do. 39. Look at a Working Theme 40. Questions? Daisy Olsen wpmama.com @DaisyOlsen