Home >Backend Development >PHP Tutorial >Decide how to develop your WordPress theme framework

Decide how to develop your WordPress theme framework

WBOY
WBOYOriginal
2016-07-30 13:31:061097browse

In the first part of this tutorial series, I introduced the different types of theme frameworks and explained how they work.

Before you start building your theme framework, you need to consider how it works and what it will be used for, so that you can find the most suitable development path from the beginning.

In this lesson, I'll walk you through every aspect you need to consider, including whether your framework is open to the public, whether it will be used by non-programmers or developers, and other features you may want to add. .

Determining your development path requires two steps: first, determine how your theme framework will be used; second, on this basis, confirm all the content you need to include.

How to use your theme framework?

The way you use a theme framework will affect what you include and how you structure the framework.

Consider the following:

  • Who is your theme framework - just you or a few other developers?
  • Will your theme framework be available to developers or users with little to no programming experience?
  • Will your theme framework be open to the public?

Is it just you or some other developers?

If your framework is only to meet your personal needs, you only need to consider your own needs when developing; however, in the long run, it is still very important to try to build it as robust as possible from the beginning. It makes sense, so you should:

  • Use WordPress coding standards
  • Apply DRY (Don’t Copy Yourself) principles
  • Use W3C validation checker to verify your code and make sure your code is accessible.
  • Add code descriptions - Even if others don't look at your code, you will be surprised how easy it is to forget a piece of code when you write it again many months later.
  • Updates using version control framework.

Decide how to develop your WordPress theme framework

If your theme framework will be provided to other developers (perhaps your colleagues), then in addition to adopting all the above practices, you may also need to:

  • Provide the framework structure , functions and hooks overview files.
  • Think about the way you share and collaborate on code - using a collaboration system like GitHub makes this incredibly easy.
  • Document your releases or connect them to milestones and/or release them on GitHub.

Provided to developers or users?

Some theme frameworks are specifically intended for users who cannot code, who can extensively customize the theme framework without writing any code, while others are for developers and provide hooks and functions so that they can Use it to customize and extend your own framework. Others will do both, there will be a comprehensive user interface and an API (application programming interface).

Just because your framework will be used by non-developers doesn’t mean you want to release it to the public - you may have colleagues who are web designers and you want to give them access, or let your clients use your Frames to customize their website.

If your framework is aimed at users who cannot code, you need to consider:

  • One or more theme options interface so that your users can customize it themselves.
  • You can choose to use the theme customizer instead of the theme options interface. The advantage is that users can directly see their changes while customizing the theme, or both.
  • Widget area that allows users to add their own content in different places on the web page.
  • Menus so that users can browse the website (there may be more than one area containing menus, this is up to you).
  • Child theme support so users can quickly install and create a working website.
  • Function library, including all the functions you want, such as sliders or lightbox effects.
  • Necessary documentation and related help so that users know how to use all your results (some of them are very useful, but remember to take your time and improve step by step)

If your target audience is some professional developers, They will use your theme framework in conjunction with their own child themes and/or plugins, so you may want to consider some of the above, but you also need to consider including features from the list below:

  • Action hooks allow developers to insert their own code into your template files without creating a duplicate template file.
  • Filter hooks allow developers to modify the output content of template files.
  • Developers can use custom functions in their child themes.
  • Template sections and include files to reduce code duplication. This way, you will benefit a lot when using the framework, and other developers will also find this useful if in theory you need to create template files in the child theme.
  • Make sure your file naming and structure are logical and add appropriate descriptions to these files so people can find them easily.

Public or not?

If you plan on releasing your framework to the public, there is a whole set of additional things to consider:

  • If you are submitting your framework as a theme through the WordPress Theme Gallery, you will need to adhere to the theme review guidelines.
  • Since users may use your framework in any scenario and website type, you need to test whether your framework can work properly in various environments. Maybe you can enlist other users and developers to help you in this regard. test.
  • Certain types of documentation are essential for both developers and users, depending on your target audience.

Decide how to develop your WordPress theme framework

You also need to consider how to market your framework: even if it is free, if you want more people to use it, then you need to promote it through a website, other ways are Social media, search engine optimization (SEO), third-party theme stores, word of mouth, local gatherings, WordCamps conferences (non-profit conferences organized by WordPress users), etc.

Elixir - Restaurant WordPress Theme

What should your theme framework include?

A large part of your theme’s functionality will be determined by the needs of the users you just identified. When deciding on the audience for your theme framework, if possible, ask your audience what their specific needs are and then list some of the features your theme will include.

This list will include (but is not limited to) the following choices:

  • Template files (including template parts and include files)
  • Functions
  • action hooks and filter hooks
  • Widgets Areas
  • Directory
  • Options and Settings Interface
  • Theme Customizer Support
  • Files
  • Child Themes

For these, confirmation is required:

  • What exactly does it do
  • What does it do
  • It Where will the code appear

In addition to these features determined by different user groups, you may also want to include other features, such as:

  • Will your framework have a built-in layout? Is this layout configurable or will it be coded via a child theme?
  • How much of this functionality will be included in your parent theme? Some frameworks have extreme minimal styling, while others (like myself) adopt object-oriented CSS (OOCSS) which makes styling easier in child themes.
  • Is your framework responsive or coded via a child theme? If your parent theme is responsive, you need to make sure that it is not overridden by any layout styles in the child theme, where OOCSS comes in handy.
  • Will you add SEO (search engine optimization) functionality to your framework? Will it be provided by WordPress, or will it be added by the user using a separate plug-in? ​​​​​​​​​​​​​​​​​​​​​​​
  • If it is necessary to add within your framework or through a child theme, will you include things like sliders, galleries, background images, etc.?

This list may change over time as your own needs and those of your users change. Make sure from the beginning that your framework is easily extensible and that you can add new functionality whenever you want.

Summary

Developing your own theme framework can be said to be a great initiative. This will save you a lot of development time in the long run, but it also takes a lot of work.

Spend some time to understand the audience who use the theme framework and what functions they need, because this is very meaningful and valuable to yourself and other users, and if you want to expand and modify the framework in the future, you can It will be much easier.

The above has introduced the decision on how to develop your WordPress theme framework, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn