Child Themes for WP Framework

45

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 functions compared to the framework.

The obvious way to go about this is to dive in and start creating template files in your child theme to override those in the framework, but thanks to the action and filter hooks you’ve added to your framework, this might not always be the best approach.

In this article, I’ll outline some of the techniques you can use in your child themes to make best use of your framework and improvise your workflow.

The topics I’ll cover are as follows:

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
Creating Starter Child Themes framework

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 and the sites you build:

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? (For example, I use two starter child themes, one with comment functionality and one without.)
Is there styling you tend to use for most projects, or can you use object oriented styling or a CSS preprocessor for most projects?
Are there libraries or resources you use for most new projects, or for a significant proportion of them?
Do you have two or three main categories you can place projects under, with each category involving similar development work?
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 using a hook so you can override it if a different need arises in the future.

Even if you answered no to the questions above, it’s worth creating a very basic starter theme with an empty stylesheet and functions file, and adding the instructions WordPress needs to access your framework’s parent theme .

You might also want to create a starter functions.php file with the functions you most frequently use in your child themes. You can then choose to remove any of these and/or add to them for specific projects.

Amending Code via Filter Hooks

As well as adding styling to your child theme, you’ll most likely want to make changes to the code output by the framework. The most lightweight way of doing this is via filter hooks, so it’s worth exploring those first to identify if you can use any of them.

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.

Adding Code via Action Hooks

Your theme framework will also have action hooks which you can use to insert content in various places in your sites.

If you’ve been working on the code files for the framework bundled with this tutorial series, you’ll have seven action hooks to work with:

before the header
inside the header
before the content
after the content
in the sidebar
in the footer
after the footer.
To do this, create a functions.php file in your child theme and .

There is plenty of other content you could add using your action hooks, such as sharing buttons above or below the content, extra content in the footer, a search box in the header and much more.

You might just want to add some content on specific page types, such as single blog posts, in which case the most obvious place to start would be by creating a newsingle.php template. But you can still use your action hooks with the addition of a conditional tag.

Creating New Template Files

On occasion you won’t be able to do what you want using the filter or action hooks in your framework, in which case you’ll need to create new template files in your child themes.

These might be the same template files as are stored in your framework, in which case the files in the child theme will override them. Or they might be new template files, for example for a new category, taxonomy or post type.

If you are creating template files in your child themes, it makes things easier if you use the template files in your framework as a starting point. The steps I follow are:

Identify the template file you need to create with reference to the WordPress template hierarchy
Create a blank file with the appropriate name in your child theme
Identify the file in your framework which is closest to the new file (again with reference to the template hierarchy)
Copy the contents of that into your new file
Make amendments to the new file as required.
Doing this saves you the work of duplicating any code which will be common between your new file and the existing files in your framework, such as the calls to include files.

When to Use a Plugin Instead

Another option you have when creating sites based on your framework is to use plugins in conjunction with your child themes. A plugin won’t replace a child theme completely, but it can be useful in the following circumstances:

The functionality you want to add isn’t theme-dependent (i.e. you want to keep it if the site ever changes theme in future). This might include registering custom post types or taxonomies, for example.
You want to use this functionality on a number of the sites you create, but not enough for it to go into a starter child theme or the framework itself.
I’ll cover developing plugins for your framework in the next part of this series.

Summary

Your theme framework is just the starting point of a library of code and files you’ll create to support the sites you develop. Each site you create will need to run on a child theme, which will have your framework theme as its parent.

As we’ve seen, your child themes will add their own styling and functionality, and they can do this by hooking into the action and filter hooks in your framework, or via the creation of new template files. It’s always a good idea to adopt the solution which needs the least code, as that makes your site faster and your life easier!

from :http://code.tutsplus.com/tutorials/creating-child-themes-for-your-wordpress-theme-framework–cms-21933

[quote font=”verdana” font_size=”14″ font_style=”italic” color=”#474747″ bgcolor=”#F5F5F5″ bcolor=”#dd9933″ arrow=”yes” align=”centre”]This Demo Content Brought to you by Momizat Team [/quote]

this is tags and keywords : wordpress themes momizat Tutorial wordpress templates

Compartilhar.

Autor

45 Comentários

  1. Make individual interior design according to all your sketches . We are cooperating with client on of all stages execute general analysis of features dwellings , carry preliminary counts . your any questions .
    Our association MISRE Roosevelt Island produce Homewyse kitchen remodel in fixed deadlines and rates.
    In the production company General Partnership OKTASI Astoria involved trained specialists, who much know about Kitchen remodel under 2000.
    The Firm renders high-quality Kitchen remodel colonial home by democratic tariffs . Masters with great professional experience work no doubt help fully kitchen room in a matter of days . The price depends on selected package of services, scope of work .

    Each room apartments, houses, cottages or other housing Crown Heights unique and has individual multifunction load. All this especially to be relevant to kitchens.

    Kitchen remodel under 20000 Union Square – kitchen renovation manhattan

  2. Good morning! .
    Our Organization in Little Egypt more five years, during this period we work only female workers, on Complex cleaning and Housemaid. Housekeeping maid service will maintain cleanliness and order in rooms in the apartment by set contract . We employ in oll qualified Housemaid, ready to take on Deep cleaning at home of the most varied complexity and execute it fast and good. When we speak about a large apartment, our company provide you required for you quantity staff. Our company offers not only experienced personnel , at the same time affordable prices for each customer for Maid service в Ocean Hill. To order Weekly house cleaning and Housekeeping maid service advise you personally visit our site in Park Slope. The Tidy Cleaning of premises с Home maid clean unchanged more pleasant in Bergen Beach

    We provide expert book a cleaner for personal clients. Using European tools and also accredited tools, we achieve maximum results as well as offer cleansing quickly.

    Our friendly group supplies you to get accustomed with favorable regards to participation for corporate customers. We properly approach our tasks, tidy using expert cleaning products and also specialized tools. Our employees are educated, have medical publications as well as know with the nuances of removing facility and also hard-to-remove dust from surface areas.

  3. Nuru Massage: massage rate

    We greet you! Our firm those who make your privacy life much easier . Our organization that gives you massage .

    Special characteristic feature our nude salon is not an enforced setting. We create site to develop.
    We can offer for you personally check whatever method massage techniques now. We are always we are waiting you personally in our SPA.

  4. Септик для частного дома био

    Наша международная компания занимается не только лишь проектированием и сборкой, профессионалы дополнительно делают последующее сопровождение автономной канализации.
    Автономная канализация – наиболее востребованная часть технических коммуникаций
    Это в целом предоставляет вам гарантию того момента, что автономная канализация работает без перебоев в течение многих лет.
    Автономная канализация цена под ключ-это сегодня наш профиль
    Всем известно, что профессионализм – это сегодня наиболее важное

  5. A lot of thanks for each of your hard work on this web page. Kim really likes going through investigation and it’s really easy to understand why. Many of us know all of the dynamic method you make powerful strategies on this web blog and as well as improve participation from people on that issue so our girl is in fact learning a lot of things. Have fun with the remaining portion of the new year. You are conducting a really good job.

  6. Thank you for every one of your labor on this web site. My daughter really loves making time for investigations and it’s really obvious why. Most people learn all regarding the lively mode you present reliable tactics through this web site and even inspire participation from some others on the point then our favorite princess is now starting to learn a whole lot. Take advantage of the rest of the year. You are always doing a remarkable job.

  7. Needed to send you this very small word to finally thank you so much yet again relating to the stunning thoughts you have shared on this site. This is so unbelievably open-handed with you to provide unreservedly what numerous people would have sold for an electronic book to help with making some profit on their own, primarily since you might well have tried it in the event you wanted. Those things likewise worked to become a great way to recognize that someone else have the same passion similar to my very own to see very much more with regard to this problem. I know there are some more pleasurable situations up front for those who start reading your website.

  8. I enjoy you because of all your efforts on this site. Ellie enjoys doing internet research and it’s easy to see why. All of us hear all concerning the compelling means you deliver good information by means of the blog and as well cause contribution from other people about this concept plus my daughter is being taught a lot. Enjoy the remaining portion of the new year. You’re the one carrying out a first class job.

  9. I’m just commenting to let you be aware of of the extraordinary discovery my cousin’s daughter experienced going through your site. She even learned lots of issues, most notably how it is like to have a very effective giving mindset to have many others just gain knowledge of chosen extremely tough matters. You really did more than our desires. Many thanks for distributing the important, healthy, educational and as well as easy thoughts on the topic to Gloria.

  10. Thanks for your own work on this website. My mother take interest in setting aside time for research and it is simple to grasp why. My spouse and i notice all relating to the powerful way you provide very helpful tips via your website and in addition recommend response from visitors on this subject matter while our own simple princess is undoubtedly studying so much. Take pleasure in the rest of the year. You have been performing a tremendous job.

  11. I needed to draft you one little bit of observation so as to say thank you once again for those incredible opinions you’ve documented here. It is quite pretty generous of people like you to deliver freely exactly what a number of people could possibly have made available as an e book to end up making some cash for themselves, most importantly given that you could possibly have done it if you ever decided. These inspiring ideas also served like the fantastic way to comprehend other individuals have similar eagerness like my own to know great deal more on the subject of this issue. I’m sure there are many more fun occasions in the future for individuals who look over your blog post.

  12. A lot of thanks for each of your hard work on this web page. Kim really likes going through investigation and it’s really easy to understand why. Many of us know all of the dynamic method you make powerful strategies on this web blog and as well as improve participation from people on that issue so our girl is in fact learning a lot of things. Have fun with the remaining portion of the new year. You’re the one conducting a good job.

  13. Thank you for every one of your labor on this web site. My daughter really loves making time for investigations and it’s really obvious why. Most people learn all regarding the lively method you make invaluable steps on this web blog and as well as improve participation from people on that idea so our girl is certainly learning a lot of things. Have fun with the remaining portion of the new year. You are conducting a pretty cool job.

  14. I intended to compose you a bit of note in order to give many thanks again considering the beautiful concepts you’ve contributed above. This is so wonderfully open-handed with you to supply without restraint what exactly some people would have supplied for an electronic book to make some profit on their own, specifically since you might well have tried it in the event you wanted. Those tips likewise worked to provide a great way to understand that the rest have the same zeal the same as my very own to understand whole lot more with respect to this problem. I think there are thousands of more pleasurable times up front for those who take a look at your website.

  15. I am also writing to make you know what a impressive encounter my friend’s girl gained reading through your web page. She learned plenty of pieces, which include what it’s like to possess an amazing helping mood to let most people smoothly know several impossible subject matter. You truly exceeded our own expectations. Thank you for offering these invaluable, safe, explanatory and even fun tips about this topic to Julie.

  16. Thanks for your own work on this website. My mum take interest in setting aside time for research and it is simple to grasp why. We notice all relating to the powerful way you provide very helpful tips via your website and therefore strongly encourage response from visitors on this subject matter while our own simple princess is undoubtedly studying so much. Take pleasure in the rest of the year. Your performing a tremendous job.

  17. I simply wished to thank you very much yet again. I do not know what I would have tried without these techniques shared by you regarding this subject matter. It was before the scary scenario in my position, nevertheless taking note of this specialized tactic you solved the issue took me to weep with happiness. Now i’m thankful for your support and thus trust you really know what an amazing job you were putting in training the mediocre ones via your webpage. Most probably you haven’t met any of us.

  18. I simply wished to thank you very much yet again. I do not know what I would have used without those tips and hints shown by you relating to this theme. This has been the traumatic setting in my view, nevertheless viewing your well-written technique you treated the issue took me to weep with joy. Now i am thankful for your work as well as wish you recognize what an amazing job your are undertaking training the others with the aid of your website. Probably you haven’t met any of us.

  19. I’m just commenting to let you be aware of of the fabulous discovery my cousin’s daughter experienced going through your site. She even learned lots of issues, most notably how it is like to have a very effective giving mindset to have many others just gain knowledge of chosen grueling matters. You really did more than our desires. Many thanks for distributing the important, healthy, educational and as well as easy thoughts on the topic to Gloria.

  20. I’m just commenting to let you be aware of of the exceptional discovery my cousin’s child enjoyed going through your blog. She discovered a wide variety of details, most notably how it is like to have a very effective coaching heart to get many more effortlessly fully understand certain extremely tough matters. You actually did more than my desires. I appreciate you for displaying such helpful, healthy, educational and also cool guidance on that topic to Evelyn.

  21. Thanks for your whole work on this website. My mum takes pleasure in setting aside time for research and it is simple to grasp why. We notice all relating to the powerful ways you render very useful tips and tricks via your website and therefore strongly encourage response from website visitors on this theme while our own simple princess is without a doubt understanding so much. Take pleasure in the rest of the year. Your performing a very good job.

  22. I precisely needed to appreciate you once again. I am not sure the things that I might have handled in the absence of the entire pointers provided by you on such a subject matter. It was before the scary scenario in my position, nevertheless taking note of this specialized tactic you solved the issue took me to weep with happiness. Now i’m thankful for your support and thus trust you really know what an amazing job you were putting in training the mediocre ones via your webpage. Most probably you haven’t met any of us.

  23. I simply needed to thank you so much once again. I am not sure the things that I would’ve implemented without the type of secrets provided by you on such a question. It seemed to be a very frustrating issue in my opinion, however , observing the very specialised strategy you processed that made me to leap over gladness. I am just happy for this information and in addition pray you know what a great job you happen to be getting into teaching people thru your web page. More than likely you have never got to know any of us.

  24. I am just writing to make you understand what a perfect experience my wife’s girl obtained using your webblog. She noticed so many pieces, which included what it is like to possess an excellent helping spirit to let others with no trouble learn about specific specialized things. You truly surpassed readers’ expected results. Thank you for providing these priceless, trusted, informative as well as fun tips about this topic to Lizeth.

  25. My wife and i were very thankful when Raymond managed to round up his inquiry from your ideas he gained in your site. It’s not at all simplistic just to choose to be giving for free ideas that most people have been making money from. And we all do understand we have the website owner to be grateful to because of that. The explanations you’ve made, the easy site menu, the friendships you can give support to engender – it’s everything extraordinary, and it’s facilitating our son and our family feel that that idea is cool, and that is highly important. Many thanks for all the pieces!

  26. My spouse and i felt now fulfilled that Ervin could deal with his investigations out of the ideas he got out of the web page. It’s not at all simplistic to just choose to be giving freely instructions that many other folks have been selling. And we also fully grasp we have the website owner to be grateful to for that. The entire explanations you have made, the simple site menu, the friendships you can give support to engender – it’s got everything fantastic, and it’s really facilitating our son and the family feel that the issue is entertaining, and that is particularly indispensable. Thank you for all the pieces!

  27. My spouse and i got now fulfilled that Ervin could deal with his investigations out of the ideas he got out of the web page. It’s not at all simplistic to just choose to be giving freely instructions that many other people have been selling. And we also fully grasp we have got the website owner to be grateful to for that. The entire explanations you have made, the simple site menu, the friendships you can give support to foster – it’s got many fantastic, and it’s really facilitating our son and the family imagine that the issue is entertaining, and that is particularly indispensable. Thank you for everything!

  28. I am glad for writing to make you know what a magnificent encounter my friend’s girl gained studying your web site. She learned plenty of pieces, which include what it’s like to possess an awesome helping nature to let other folks very easily know just exactly several multifaceted subject matter. You truly exceeded people’s expectations. Thank you for presenting these powerful, safe, explanatory and in addition fun tips about this topic to Julie.

  29. I am only writing to make you understand what a remarkable experience our princess undergone viewing your webblog. She picked up some things, which included what it is like to possess an ideal teaching spirit to make the mediocre ones without difficulty master specified tortuous things. You undoubtedly surpassed readers’ expected results. Thanks for rendering those useful, trustworthy, revealing as well as unique tips on your topic to Mary.

  30. Thanks for the useful information on credit repair on your web-site. The thing I would offer as advice to people will be to give up a mentality they will buy at this moment and pay back later. As being a society most people tend to repeat this for many factors. This includes family vacations, furniture, plus items we really want to have. However, you must separate a person’s wants from the needs. When you’re working to fix your credit score you really have to make some trade-offs. For example you possibly can shop online to economize or you can click on second hand suppliers instead of highly-priced department stores to get clothing.

  31. Thanks for your own work on this website. My mother take interest in setting aside time for research and it is simple to grasp why. My spouse and i notice all relating to the powerful way you provide very helpful tips via your website and in addition recommend response from visitors on this subject matter while our own simple princess is undoubtedly studying so much. Take pleasure in the rest of the year. You have been performing a tremendous job.

  32. Thanks for the tips about credit repair on this blog. Things i would advice people would be to give up the mentality that they’ll buy right now and pay later. As a society all of us tend to do this for many things. This includes holidays, furniture, as well as items we want. However, you have to separate your own wants from all the needs. When you are working to improve your credit rating score you have to make some sacrifices. For example you are able to shop online to save money or you can turn to second hand shops instead of costly department stores with regard to clothing.

  33. I simply wished to thank you very much yet again. I do not know what I would have undertaken without these thoughts shared by you regarding this subject matter. It was before the scary scenario in my position, nevertheless taking note of this specialized tactic you solved the issue took me to weep with happiness. Now i’m thankful for your support and thus trust you really know what an amazing job you were putting in training the mediocre ones via your webpage. Most probably you haven’t met any of us.

  34. I am commenting to let you know of the great encounter my friend’s daughter found reading your site. She figured out numerous issues, not to mention what it’s like to have a wonderful giving mindset to have men and women quite simply have an understanding of selected hard to do subject areas. You really exceeded our expectations. Many thanks for giving the insightful, safe, explanatory and as well as easy thoughts on the topic to Janet.

  35. My spouse and i have been really joyous that Jordan managed to do his research through your precious recommendations he had through the web pages. It is now and again perplexing to just find yourself handing out solutions which people today may have been selling. So we know we need the writer to give thanks to for that. The most important illustrations you have made, the simple web site navigation, the relationships you will help to instill – it’s got most powerful, and it’s really leading our son in addition to the family reason why the situation is fun, which is really mandatory. Thank you for the whole lot!

  36. Thank you for your entire labor on this web site. My mom really loves managing investigations and it is obvious why. My partner and i learn all regarding the lively tactic you present sensible things through your web site and in addition invigorate response from some others on the situation then our favorite princess is really starting to learn a whole lot. Take advantage of the rest of the year. You have been doing a stunning job.

  37. Thanks for the advice on credit repair on this excellent site. Some tips i would tell people should be to give up this mentality that they may buy currently and fork out later. Being a society many of us tend to make this happen for many issues. This includes vacation trips, furniture, along with items we’d like. However, you’ll want to separate your current wants out of the needs. If you are working to boost your credit score actually you need some trade-offs. For example you’ll be able to shop online to save cash or you can look at second hand merchants instead of high-priced department stores pertaining to clothing.

Leave A Reply

X