Firstborn child theme   word camp presentation - atlanta 2013
Upcoming SlideShare
Loading in...5
×
 

Firstborn child theme word camp presentation - atlanta 2013

on

  • 3,412 views

Learn how to mod themes the right way. Using child themes you won’t loose your edits when there’s a theme update. (101) We’ll go over the advantages and how to set up a child theme. (102) Plus ...

Learn how to mod themes the right way. Using child themes you won’t loose your edits when there’s a theme update. (101) We’ll go over the advantages and how to set up a child theme. (102) Plus we’ll cover some tricks to make the process a bit easier.

Statistics

Views

Total Views
3,412
Views on SlideShare
3,411
Embed Views
1

Actions

Likes
0
Downloads
8
Comments
0

1 Embed 1

http://wptvmods.wordpress.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Firstborn child theme   word camp presentation - atlanta 2013 Firstborn child theme word camp presentation - atlanta 2013 Presentation Transcript

  • Your firstborn child theme Child themes 101+2 WordCamp Atlanta 15 March 2013 Evan Mullins @circlecubeLearn how to mod themes the right way. Using child themesyou wont lose your edits when theres a theme update.(101) Well go over the advantages and how to set up a child theme.(102) Plus well cover some tricks to make the process a bit easier.
  • Who am I? Evan Mullins circlecube.com currently:2006 started in Web Design Interactive Director at Brand Fever, a Creative Marketing2007 started using WordPress for blogging Agency down the street. http://brandfeverinc.com2008 started theming
  • Firstborn Child theme101 102Themes Deeper into WPChild themes HelpersWhy Best PracticesHow
  • 101What is a WordPress theme?
  • Your Theme is your BrandYour theme is your design, identity & brand.
  • What is a WordPress theme?The WordPress themesystem is a way to skinyour site.Its a collection of files that worktogether to produce a graphicalinterface with an underlyingunifying design for a weblog. Thesefiles are called template files. ATheme modifies the way the site isdisplayed, without modifying theunderlying software.http://codex.wordpress.org/Themes
  • What is a WordPress theme?A theme, template, skin, etc… is aready to use design and layout thatyou can pop right onto your existingWordPress site. WordPress handlesall of the content for you (posts,pages, comments), while the themetransforms that content into abeautiful and clean layout for yourvisitors to see.http://www.woothemes.com/frequently-asked-questions/#whatisatheme
  • What is a WordPress theme?Think of it like a house. WordPressprovides the foundation and framing,while your theme adds in the paint,flooring, curtains, etc. – everythingyou need to construct the “look” ofyour site.http://ithemes.com/start-here/
  • What is a WordPress theme?The key takeaway about WordPress themes anybeginner must know is that at any moment aWordPress website’s theme may be changedwithout adversely affecting the actual content ofthe website.Graph Paper Press beginner’s guide: http://downloads.graphpaperpress.com.s3.amazonaws.com/beginners-guide-to-wordpress.pdf
  • What is a WordPress theme?All the files that Whats the point?determine the visualor front-end of the Themes separate a sitessite. A theme is what presentation from thethe site looks like and system files.potentially somefeatures of the site by Like a CMS separates the actual content.incorporating thingslike custom post types,custom fields, etc.
  • Good theme != SuccessAlthough helpful, agood theme does notautomatically makea site good orsuccessful.(Although a bad theme couldhinder success or even render yoursite useless)
  • Friendlyreminder:As always,CONTENTis King.
  • Types of themesCustomFreePremiumCustomizedStarterFrameworkParentChild
  • Free
  • Premium
  • Starter
  • FrameworkA "drop-in" code library framework is not a stand-alone Theme. Suchframeworks cannot be installed nor used as a stand-alone Theme.Rather, these libraries are included with the Theme, and"bootstrapped" to the Theme by being included in the Themesfunctions.php file.A "base/starter" Theme framework is stand-alone Theme designedto be a flexible foundation for quicker WordPress development,usually serving as a robust Parent Theme for Child Themes. SomeTheme frameworks can also make theme development moreaccessible, removing the need for programming or designknowledge with options pages.
  • Framework
  • Parent Any theme can be a parent. There are no sterile themes. (but some do make better parents & are built with child themes in mind)
  • Child Themes? The analogy stops there. InCleverly named WordPress child themes inherit frombecause, like real life the parent, but they dont drive the parent theme crazy.parent - childrelationships, they In fact the parent theme is not affected in the least by the childinherit characteristics theme. (and thats kinda the point)of the parent ... Plus there are no grand-parent themes.
  • If its confusing, justthink sub-theme. Itinherits all parts of theparent theme and letsyou customize it.
  • Not sold yet?I can hear it now:"I already customize theme easily,I just edit the files."
  • Why Use a Child Theme?A WordPress child theme is a theme that inherits the functionality ofanother theme, called the parent theme, and allows you to modify, oradd to, the functionality of that parent theme. when the parentMaking a child theme is very simple. Create a directory by using FTPor whatever file management application your host provides. Put aproperly formatted style.css file in it, and you have a child theme! theme is updated, yourThe child theme contains a "Template: parent-theme-dir" header todistinguish it from standalone themes. With a little understanding ofHTML and CSS, you can make that very basic child theme modify modifications arethe styling and layout of a parent theme to any extent without editingthe files of the parent theme itself. That way, when the parent themeis updated, your modifications are preserved. preserved.You can make the child theme extend virtually every aspect of aparent theme, and again, without actually changing the parent themefiles.Creating a theme as achild theme is a hugehead start.
  • Same Concept with WP CoreIts best practice toavoid editing core files.Because then you have forked core (which iscool if thats what you meant to do. Some coolprojects are started this way.) and any futureupdates to WordPress and your edits areoverwritten.
  • "Child themes and aframework are the only wayyou should build yourWordPress site" - Matt Mullenweg
  • So, what exactly is a theme?● Your theme is your site and brand● There are many kinds/types of themes● Not all equal ○ purpose ○ design ○ quality ○ documentation ○ price ○ support ○ features ○ license ○ security ○ SEO ○ ...
  • What files make a theme?Themes are acollection of fileslocated a folder inyour wordpressthemes directory onyour web server.
  • Anatomy of a themeWordPress Themes live in subdirectories residing in wp-content/themes/. The Themes subdirectory holds all of theThemes stylesheet files, template files, and optionalfunctions file (functions.php), JavaScript files, and images.For example, a Theme named "test" would reside in thedirectory wp-content/themes/test/WordPress Themes typically consist of three main types offiles, in addition to images and JavaScript files. 1. The stylesheet called style.css, which controls the presentation (visual design and layout) of the website pages. 2. WordPress template files which control the way the site pages generate the information from your WordPress database to be displayed on the site. 3. The optional functions file (functions.php) as part of the WordPress Theme files.
  • Anatomy of a Child ThemeThe simplest Theme possible is a childtheme which includes only a style.css file.This is possible because it is a child ofanother theme which acts as its parent.
  • What files make a childtheme?A child theme automatically includesor inherits all the parent themefunctionality. Styles are notautomatic, but can be pulled in easily.
  • style.css In addition to CSS style information for your theme, style.css provides details about the Theme in the form of comments. The stylesheet must provide details about the Theme in the form of comments. No two Themes are allowed to have the same detailslisted in their comment headers, as this will lead to problems in the Theme selection dialog. If you make your own Theme by copying an existing one, make sure you change this information first.
  • Create a child theme1. Make a newfolder in yourthemes directory.Name it whatever, (probablyreflecting the name of thetheme).
  • Create a child theme2. Add a stylessheetfile, style.css
  • Create a child theme3. Add theme details(meta data) tostylesheet in form of acomment block.Standard provided byWordPress.
  • Create a child theme4. Add styles andcustomize.
  • Create a child themeOptional:● functions.php● Template files● additional images● scripts● etc
  • Override your ParentA child theme can override parenttheme files, functionality or codeA template with the same name in achild theme will be used rather than aparent theme template.A child theme functions.php file isloaded before the parent theme.
  • Questions?102
  • Reasons to child-themeAdd widget areasCustom post typesCustom taxonomiesResponsiveRebrand
  • Child Theme Support All themes required (?) to facilitate a child theme! This section is draft only. ● Themes are required to facilitate the use of Child Themes. A "basic" Child Theme (i.e. a style.css with Template header tag and @import() of the Template style.css), when activated, should function exactly as the Theme itself functions. ● Themes are required to include functional and resource files in a manner that facilitates the use of Child Themes: ○ Use get_template_directory_uri() to include functional files, or resources that are not intended to be included in/over-ridden the Child Theme. ○ Use get_stylesheet_directory_uri() to include resources that are intended to be included in/over- ridden by the Child Theme.
  • Some Popular Parent Themestwenty somethingsthematicgenesishybrid_s...
  • Theme Template HierarchyWhich template file(s) will WordPress usewhen it displays a certain type of page?The huge logic tree (diagram) that helpsWordPress decide which template to show forevery type of content. It shows the defaultsand fallbacks, notice how everything defaultsback to index as a fallback if that specific typeof content does not have a template.
  • pop quiz!
  • pop quiz!http://example.com/category/uncategorized/
  • pop quiz!http://example.com/portfolio-post-type/my-first-photograph/
  • HooksHooks are provided by WordPress to allow you to hookinto the rest of WordPress. That is, your functions hookinto WordPress functions. Then when the WordPressfunctions are called at any time, it sets your code in motion.
  • Hooksactions filtersActions are the hooks that the WordPress Filters are the hooks that WordPresscore launches at specific points during launches to modify text of various typesexecution, or when specific events occur. Your before adding it to the database or sendingplugin can specify that one or more of its PHP it to the browser screen. Your plugin canfunctions are executed at these points, using specify that one or more of its PHPthe Action API. functions is executed to modify specific types of text at these times, using the Filter API.
  • HooksYou can sometimes accomplish the same goal with either an action or afilter. For example, if you want your plugin to change the text of a post,you might add an action function to publish_post (so the post ismodified as it is saved to the database), or a filter function tothe_content (so the post is modified as it is displayed in the browserscreen).Confused? Check the analogy comparing hooks to the line at the DMV:wpdaily.co/hooks-nutshell/
  • The LoopLoops in programming do just that, they loop or repeatthemselves until a certain criteria is met.The WP loop is great because it grabs all the content fromthe database once and stores the results in memory, thenloops through the results and creates the page. Its muchfaster than grabbing content over and over one at a time.
  • Loop Example BasicIn English: In Code: 1. Define what content to display 2. Begin loop $the_query = new WP_Query( $args ); 3. Do stuff (print content found in the loop) if (have_posts()) : 4. End loop while (have_posts()) : the_post(); the_content(); endwhile; endif;
  • Loop Example MoreIn english 1. Define what content to display 2. Begin loop 3. Do stuff (print content found in the loop) 4. End loop
  • Loop - The QueryBefore starting your loop you can set arguments in yourquery to decide:● Which items to display● Which category/taxonomy to display● How to sort the results● Anything else from Template Tags
  • GenerateWPGenerateWP provides user-friendly tools for developers to create advanced systems built on WordPress.Writing your own code takes time, with plugins you never know if it stays in active development or not. GenerateWP reducedevelopment time and provides high quality code built using the latest WordPress standards.Usage ● Choose your generator. ● Fill out the user-friendly form. ● Click the "Update Code" button. ● Copy the code to your theme/plugin.Generators 1. wp-config.php Generator - Create custom code for wp-config.php file. 2. Taxonomy Generator - Create custom code for Taxonomies using register_taxonomy() function. 3. Post Type Generator - Create custom code for Post Types using register_post_type() function. 4. Post Status Generator - Create custom code for Post Status using register_post_status() function. 5. Sidebar Generator - Create custom code for Sidebars using register_sidebar() function. 6. Menu Generator - Create custom code for Navigation Menus using register_nav_menus() function. 7. Theme Support Generator - Create custom code for Theme Features using add_theme_support() function. 8. Shortcodes Generator - Create custom code for Shortcodes using add_shortcode() function.
  • “You cannot step twice into the same river; for other waters are ever flowing in”@Heraclitus
  • Thank You!Any Questions?Slides @ http://circlecube.com/wordpress/ Evan Mullins circlecube.com