Creating a function which you then attach to a filter hook is much more efficient than creating a whole new template file for the new code; however, if you find yourself doing this repeatedly with the same filter hook, you might want to consider changing that filter hook to an action hook and writing a new function for each project which you activate via that action hook. To be more efficient, you might want to create a set of relevant functions which you place in the functions file of different start themes or even create a plugin with your function which you activate when needed. I’ll cover plugins in more detail later in this series.If you’ve answered yes to any of these questions, then developing one or more starter child themes may save you time. You can create a set of child themes with the basic code that you repeat across all projects using them, and then you don’t need to rewrite that code (or create those files) for each new project.Note on caveat: If you’re adding some code to every single new project, you may want to add it to your framework instead of to child themes, maybe by project which you activate via that action hook. To be more efficient, you might want to create a set of relevant functions which you place in the functions file of different start themes or even create a plugin with your function which you activate when needed. I’ll cover plugins in more detail later using a hook so you can override it if a different need arises in the future.The theme framework you’ve built will be used as a parent theme in the sites you develop. This means that in each case you’ll need to create a child theme to create a unique site with its own design and with extra or different. If you’ve answered yes to any of these questions, then developing one or more starter child themes may save you time. You can create a set of child themes with the basic code that you repeat across all projects using them, and then you don’t need to rewrite that code (or create those files) for each new project. code (or create those files) for each new project.Note on caveat: If you’re adding some code to every single new project, you may want to add it to your framework instead of to child themes, maybe by project which you activate
- Creating starter child themes
- Amending code via the framework’s filter hooks
- Adding code via the framework’s action hooks
- Creating template files in your child theme
- When to use a plugin instead
new project.Note on caveat: If you’re adding some code to every single new project, you may want to add it to your framework instead of to child themes, maybe by using a hook so you can override it if a different need arises in the future.
Creating Starter Child Themes
The main purpose of developing your theme framework is to adopt the DRY (Don’t Repeat Yourself) principle, and that applies to your child themes, too.It can make you more efficient if you create one or more ‘starter’ child themes for use with your framework, which contain the core code you need to get started on new projects.When deciding how to go about doing this, consider the way you work
- Do you create a lot of sites for clients in the same sector with similar needs?
- Do you want to offer low cost template based sites to smaller clients?
- Are there specific template files you tend to create for most of your new projects?
- Is there functionality you need to include on some sites but not others?
- Is there styling you tend to use for most projects, or can you use object
- Are there libraries or resources you use for most new projects
- Do you have two or three main categories you can place projects under
If you’ve answered yes to any of these questions, then developing one or more starter child themes may save you time. You can create a set of child themes with the basic code that you repeat across all projects using them, and then you don’t need to rewrite that code (or create those files) for each source : http://code.tutsplus.com/tutorials/creating-child-themes-for-your-wordpress-theme-framework–cms-21933