Meetup child-themes

Embed Size (px)

Citation preview

  • 1. What is a Child Theme
    • Installed and activated like any other theme
  • 2. Dependent on a parent theme for elements not found in the child theme

3. Only style.css is required 4. Can be used to re-skin a theme 5. Can add functionality 6. Can over-ride parts of the parent theme 7. Why Use a Child Theme

  • Future-proof your customizations

8. Rapid development 9. Build upon a consistent codebase 10. Understanding of PHP and WordPress themeing is helpful but not required for basic child themes 11. Child Theme Files

  • WordPress template hierarchy

12. style.css Only Child theme file is used. 13. functions.php Both parent and child files always run. 14. Other files Child theme checked first then Parent theme. First file found runs.Specific -> General 15. Making a Child Theme

  • Get to Know your Parent Theme

16. Create style.css 17. Page Templates 18. Overriding Parent Theme Files 19. Demo site : http://wpthemedemos.com 20. Required in style.css /* Theme Name: Twenty Ten Child Demo Description: A Child Theme for Twenty Ten for Demonstration. Theme URI: http://daisyolsen.com Author: Daisy Olsen Author URI: http://daisyolsen.com Template: twentyten Version: 1.0 */ 21. style.css

  • Option #1 import style.css from parent theme @import url('../twentyten/style.css');

22. Option #2 Copy/Paste entire style.css from parent theme into child theme style.css 23. Option #3 Build new style.css from scratch 24. Hooks

  • Twenty Ten has one hook built in for adding additional content. WordPress also includes some hooks that can be used.

do_action( 'twentyten_credits' );

  • Think of a hook as an insertion point.

add_action('twentyten_credits', 'my_credits'); function my_credits() { echo 'This is my credit line using a function'; } 25. Replace Theme Template Files

  • OurDemo Child themereplaces the footer.php file with a customized version which changes the default footer credits with customized ones.

26. If a template file exists in the child theme the parent theme file is ignored. 27. Template Parts

  • New to WordPress 3.0

28. Twenty Ten allows you to modify the loop by creating a new file in the child theme with a modified version of loop.php 29. We will modify the way the category archive displays with loop-category.php 30. Theme Frameworks

  • Built with the intention of being modified via child theme

31. Extensive Action/Filter Capabilities 32. Active Development 33. Popular Parent/Child Frameworks

  • Hybrid

34. Thematic 35. Genesis(Commercial) - StudioPress 36. Builder(Commercial) - iThemes 37. Resources

  • Codex: Child Themes

38. Aaron Jorbin's Guide 39. Understanding Child Themes 40. Modify WordPress Themes The Smart Way