Decide how to develop your WordPress theme framework

Source: Internet
Author: User
: This article describes how to develop your WordPress theme framework. if you are interested in the PHP Tutorial, refer to it. In the first part of this series of tutorials, I introduced different types of theme frameworks and explained how they work.

Before you begin to build your theme framework, you need to consider how it works and what it will be used, in this way, you can find the most appropriate development path from the very beginning.

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

To determine your development path, you need to take two steps: 1. determine how your theme framework will be used; 2. confirm all the content you need to include on this basis.

How to use your theme framework?

The topic framework will affect the content you want to include and the way you build the framework.

Consider the following:

  • Audience of your Theme Framework-only you or some other developers?
  • Will your theme framework be provided to developers or users who have little programming experience?
  • Will your theme framework be open to the public?

Just you or some other developers?

If your framework only meets your individual needs, you only need to consider your own needs during development. However, in the long run, try to make it as stable and meaningful as possible from the very beginning, so you should:

  • Use WordPress encoding standards
  • Apply the DRY principle (do not copy yourself)
  • Use the W3C verification checker to verify the code and ensure that your code is accessible.
  • Add Code description-even if others don't read your code, you will be surprised to find out how easy it is to forget a piece of code when you write it again many months later.
  • Use Version control framework updates.

If your theme framework is provided to other developers (maybe your colleagues), you may need:

  • Provides an overview file of framework structures, functions, and hooks.
  • Consider the way you share and collaborate on code-using a collaboration system can make it all very simple, such as GitHub.
  • Record your version, or connect them to "milestone" (milestones) and/or release on GitHub.

Provided to developers or users?

Some theme frameworks are designed for users who do not need to code. These users can customize theme frameworks extensively without writing any code, while others are for developers, hooks and functions are provided so that they can be used to customize and expand their own frameworks. Either of them works. there is a comprehensive user interface and an API (application interface ).

If your framework is used by non-developers, it does not mean that you want to release it to the public-you may have colleagues who are Website designers and you want to grant them access permissions, or let your customers use your framework to customize their websites.

If your framework is not encoded, consider the following:

  • One or more theme option interfaces, so that you can customize them.
  • You can choose to use the theme customizer to replace the theme option interface. the advantage is that you can directly view the theme changes, or both.
  • The gadgets area allows users to add their own content in different places on the webpage.
  • Menu so that users can browse the website (there may be more than one menu area, which is up to you ).
  • Subtopic support allows you to quickly install and create a work website.
  • The function library contains all the functions you want, such as the slider or Lightbox effects.
  • Necessary instruction files and related help to help users know how to use all your results (some of them are very useful, but remember to slow down and gradually improve)

If your target audience is a professional developer who will use your theme framework with their own sub-themes and/or plug-ins, you may need to consider the above content, however, you also need to consider the functions in the following list:

  • Action hooks allows developers to insert their code into your template file without creating a duplicate template file.
  • Filter hooks allows developers to modify the output content of Template files.
  • Developers can use custom functions in their subtopics.
  • The template part and include files to reduce code duplication. In this way, you will benefit a lot from using the framework. if you need to create a template file in the sub-topic theoretically, other developers will find this useful.
  • Make sure that your file name and structure are logically rational, and add instructions to these files so that people can easily find them.

Public or not?

If you plan to release your framework to the public, there will be a set of additional considerations:

  • If you want to submit your framework as a topic through the WordPress main question Library, you need to follow the topic review guide.
  • Because users may use your framework in any scenario or website type, you need to test whether your framework works normally in various environments, maybe you can win other users and developers to help you with this test.
  • Some types of documents are indispensable for developers and users. of course, it depends on your target audience.

You also need to consider how to commercialize your framework: even if it is free, if you want more people to use it, then you need to publicize it through a website, other methods include social media, search engine optimization (SEO), third-party theme stores, word of mouth, local gatherings, and WordCamps conferences (non-profit conferences spontaneously organized by WordPress users.

Elixir-Restaurant WordPress Theme

What should your topic framework contain?

A large part of your theme functions will be determined by the needs of the users you just confirmed. When determining the target audience, if possible, you can ask the specific needs of your audience, and then list some functional features that your topic will contain.

This list includes (but is not limited to) the following options:

  • Template file (including template part and file)
  • Function
  • Action hooks and filter hooks)
  • Gadgets area
  • Directory
  • Options and settings page
  • Topic customizer support
  • File
  • Subtopic

For these, you need to confirm:

  • What is its specific function?
  • What does it do?
  • Where does its code appear?

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

  • Will your framework have a built-in layout? Is this layout configurable or will it be encoded by sub-themes?
  • How many parent topics does this function have? Some frameworks have extremely minimal styles, while others (such as myself) use object-oriented CSS (OOCSS) to make style making easier in subthemes.
  • Is your framework responsive or encoded using subtopics? If your parent topic is responsive, make sure that it is not covered by any layout style in the field where OOCSS can be used.
  • Will you add the SEO (search engine optimization) function to your framework? is it provided by WordPress or is it added by users using an independent plug-in?
  • If it is necessary to add in your frame or add through sub-themes, will you include slide, gallery, background image, and so on?

This list may change over time as your own and user needs change. From the very beginning, make sure that your framework is easy to expand and you can add new features at any time.


Developing your own theme framework is a great innovation. In the long run, this will save you a lot of development time, but it also takes a lot of work.

It takes some time to understand the audience who use the theme framework and what features they actually need, because they are of great significance and value to themselves and other users, in addition, it will be much easier to extend and modify the framework in the future.

The above describes how to develop your WordPress theme framework, including some content, and hope to help those who are interested in PHP tutorials.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.