Title: Feature Packages Update
Author: Justin Tadlock
Published: June 24, 2019
Last modified: July 10, 2019

---

 [  ](https://profiles.wordpress.org/greenshady/) [Justin Tadlock](https://profiles.wordpress.org/greenshady/)
5:58 pm _on_ June 24, 2019     
Tags: [open source ( 4 )](https://make.wordpress.org/themes/tags/open-source/),
[projects ( 2 )](https://make.wordpress.org/themes/tags/projects/), [TRT ( 37 )](https://make.wordpress.org/themes/tags/trt/)

# Feature Packages Update

A couple of weeks ago, we set forth a [theme feature packages proposal](https://make.wordpress.org/themes/2019/06/07/proposal-theme-feature-repositories/).
The team got loads of good feedback. As the current lead for the proposal, I was
trying to best think how to kick-start such a project. So, I decided to just tackle
some low-hanging fruit that would provide a better idea of what this project is 
about.

The idea is to create “drop-in” packages that theme authors can use to handle some
common features. This would help standardize some of the code we’re seeing.

I created two new packages, both of which I had some existing code to pull from.
This provided us with a starting point.

Neither of these projects are at their official 1.0.0 stage. I’d like to get there
this week or next at the latest. They need a code review and testing. So, this is
an open call to check those projects out and leave any feedback.

## Autoload Package

For feature packages, theme authors need a way to autoload any PHPPHP PHP (recursive
acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose
scripting language that is especially suited for web development and can be embedded
into HTML. [https://www.php.net/manual/en/index.php](https://www.php.net/manual/en/index.php)
classes that we provide. I’d strongly recommend [Composer](https://getcomposer.org)
instead of this package.

However, not all theme authors are ready to make that leap yet. If you fall into
this camp, we put together a small PSR-4-compliant autoloader. This is a foundational
package that will allow you to use any other packages that we create. You could 
even use it for autoloading your own theme classes if you choose to do so (assuming
they follow the [PSR-4 autoloading standard](https://www.php-fig.org/psr/psr-4/)
for class and folder names).

[See the Autoloader repository →](https://github.com/WPTRT/autoload)

## Customize Section Button Package

This is a customizerCustomizer Tool built into WordPress core that hooks into most
modern themes. You can use it to preview and modify many of your site’s appearance
settings. section that allows theme authors to create a link/button to any URLURL
A specific web address of a website or web page on the Internet, such as a website’s
URL www.wordpress.org. The idea behind this was primarily for pro/upsell links from
the customizer. However, we kept it generic enough to handle any link and not limit
it to _only_ upsells.

[See the Customizer Section Button repository →](https://github.com/WPTRT/customize-section-button)

## Proposed Packages

There were a number of proposed ideas in the previous post’s comments and on SlackSlack
Slack is a Collaborative Group Chat Platform [https://slack.com/](https://slack.com/).
The WordPress community has its own Slack Channel at [https://make.wordpress.org/chat/](https://make.wordpress.org/chat/).
I’m going to list most of them with feedback for further discussion.

### Standard Template HooksHooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same.

This is a proposal to fork the original [Theme Hook Alliance](https://github.com/zamoose/themehookalliance)
project or create something similar. The idea is to create a set of standard theme
hooks that plugins and child themes can utilize.

### Customizer Framework

This is probably thinking too big. We should break this down and look at tackling
individual problems. What I mean by this is that we should build custom sections,
controls, and/or settings classes that theme authors need as individual projects.
One such example is the above “Customize Section Button,” which solves the issue
of adding a custom “pro” link to the customizer.

If we have enough smaller packages at some point in the future, it’d be super simple
to create a “WPTRT Customize Framework” that simply tells Composer to include all
of our individual packages if that was desirable. However, I tend to lean toward
themes only including code that they’re using.

### Appearance > Theme Page

The idea here is to create a standardized Appearance > ThemeName page in the WordPress
admin. My worry here is that this is far too theme-specific to do anything more 
than an abstract class that calls `add_theme_page()` and outputs a “template”.

I’d love to hear more about what we could standardize with this.

### Breadcrumbs

Not a bad idea. Not a bad idea at all.

Breadcrumbs are extremely tough to build and build right. I cringe almost anytime
I see a custom breadcrumbs implementation because I see all the inherent flaws. 
I’ve built my own breadcrumbs system, and it’s quite a beast because it handles 
100s of different scenarios.

This is an extremely complex problem to solve and would take a dedicated group of
developers to tackle it.

### Sliders and Sections

The proposal here, if I’m not mistaken, is for a standard customizer package that
allows users to select exists posts, pages, etc. that could then be used in something
like a slider or group of sections on the front end.

I think this could work as a package. Probably something along the lines of a repeatable
post drop-down.

### Mobile Navigation

A couple of different mobile navigation ideas were proposed. I’m not the best person
to lead this charge. If there’s someone with the right CSSCSS CSS is an acronym 
for cascading style sheets. This is what controls the design or look and feel of
a site./JS skills to make a solution that could work as a drop-in for themes, this
would be worth exploring.

### Color Control with Transparency

A color control for the customizer with an alpha transparency slider. Sounds like
a cool idea. I’d actually love to see an implementation of this.

### CSS Custom Properties

I didn’t quite grasp what the actual proposal for this package was.

### Nav Menu Walker

With this, I’m also not sure what the proposal is other than making sure theme authors
test their themes.

[#open-source](https://make.wordpress.org/themes/tags/open-source/), [#projects](https://make.wordpress.org/themes/tags/projects/),
[#trt](https://make.wordpress.org/themes/tags/trt/)

### Share this:

 * [  Threads ](https://make.wordpress.org/themes/2019/06/24/feature-packages-update/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/themes/2019/06/24/feature-packages-update/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/themes/2019/06/24/feature-packages-update/?share=bluesky)
 * [  Facebook ](https://make.wordpress.org/themes/2019/06/24/feature-packages-update/?share=facebook)
 * [  X ](https://make.wordpress.org/themes/2019/06/24/feature-packages-update/?share=x)
 * [  LinkedIn ](https://make.wordpress.org/themes/2019/06/24/feature-packages-update/?share=linkedin)

 * [Login to Reply](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fthemes%2F2019%2F06%2F24%2Ffeature-packages-update%2F%23respond&locale=en_US)

 1.  ![](https://secure.gravatar.com/avatar/cd986a8dc1219161f53bc2ec6718ede9c50789eb96048ccd73fca2b49d0a8114?
     s=32&d=mm&r=g)
 2.   [dmccan](https://profiles.wordpress.org/dmccan/)  8:19 pm _on_ June 24, 2019
 3.  Thanks for starting this. Nice idea about “Standard Template HooksHooks In WordPress
     theme and development, hooks are functions that can be applied to an action or
     a Filter in WordPress. Actions are functions performed when a certain event occurs
     in WordPress. Filters allow you to modify certain functions. Arguments used to
     hook both filters and actions look the same.”. Template hooks make themes so much
     more extensibleExtensible This is the ability to add additional functionality 
     to the code. Plugins extend the WordPress core software. and it seems a hallmark
     of modern themes. Perhaps off topic, but I’ve had the thought that it would be
     useful if the underscores project added this.
 4.  Sorry to be late in offering a suggestion, but with the Twenty Twenty theme on
     the horizon, a coreCore Core is the set of software required to run WordPress.
     The Core Development Team builds WordPress. theme that is accessibilityAccessibility
     Accessibility (commonly shortened to a11y) refers to the design of products, devices,
     services, or environments for people with disabilities. The concept of accessible
     design ensures both “direct access” (i.e. unassisted) and “indirect access” meaning
     compatibility with a person’s assistive technology (for example, computer screen
     readers). (https://en.wikipedia.org/wiki/Accessibility) standards compliant and
     included the features packages would be something that theme authors could use
     as a starter or parent theme.
 5.  ![](https://secure.gravatar.com/avatar/d401f6723c24ce90038075be6a7990d02d2d7480fa3735f3697832fe393557d5?
     s=32&d=mm&r=g)
 6.   [williampatton](https://profiles.wordpress.org/williampatton/)  12:55 am _on_
     June 25, 2019
 7.  I am very much in favour of this and am excited to see theme authors work collaboratively
     to get good packaged solutions to the things that authors most commonly add.
 8.  ![](https://secure.gravatar.com/avatar/a436ab0e9c96432f9852e6c89a6efba387bbbd837e6f3eb29d1c97edad80f6ec?
     s=32&d=mm&r=g)
 9.   [Drivingralle](https://profiles.wordpress.org/drivingralle/)  9:20 am _on_ June
     25, 2019
 10. Great start for the packages collection.
 11. We should get the AccessibilityAccessibility Accessibility (commonly shortened
     to a11y) refers to the design of products, devices, services, or environments 
     for people with disabilities. The concept of accessible design ensures both “direct
     access” (i.e. unassisted) and “indirect access” meaning compatibility with a person’s
     assistive technology (for example, computer screen readers). (https://en.wikipedia.
     org/wiki/Accessibility) into the loopLoop The Loop is PHP code used by WordPress
     to display posts. Using The Loop, WordPress processes each post to be displayed
     on the current page, and formats it according to how it matches specified criteria
     within The Loop tags. Any HTML or PHP code in the Loop will be processed on each
     post. [https://codex.wordpress.org/The_Loop](https://codex.wordpress.org/The_Loop)
     specially for things like menus and breadcumps.
 12. ![](https://secure.gravatar.com/avatar/99ac6675ed857de8d430540da76a7eb2da6606d034dcdfd38e6b0e05e4b5c98e?
     s=32&d=mm&r=g)
 13.  [Devin Price](https://profiles.wordpress.org/downstairsdev/)  8:20 pm _on_ June
     25, 2019
 14. I like some of these ideas. Thanks for taking the initiative on the “upsell link”
     package!
 15. I wrote a CustomizerCustomizer Tool built into WordPress core that hooks into 
     most modern themes. You can use it to preview and modify many of your site’s appearance
     settings. Framework ~checks GitHubGitHub GitHub is a website that offers online
     implementation of git repositories that can easily be shared, copied and modified
     by other developers. Public repositories are free to host, private repositories
     require a paid subscription. GitHub introduced the concept of the ‘pull request’
     where code changes done in branches by contributors can be reviewed and discussed
     before being merged by the repository owner. [https://github.com/](https://github.com/)
     ~ 4 years ago ([https://github.com/devinsays/customizer-library](https://github.com/devinsays/customizer-library)).
     The main benefit I think was good sanitization defaults for fields, but otherwise
     I’m not sure the extra abstraction layer was worth it.
 16. If sanitization is one of the main pain points (I know it was when I was reviewing
     themes), it would be nice if we could just get some default sanitization added
     to CoreCore Core is the set of software required to run WordPress. The Core Development
     Team builds WordPress.. i.e. If no custom sanitize_callback is on a color picker,
     it just sanitizes hex color by default.
 17. For breadcrumbs, I always added support for a breadcrumbs pluginPlugin A plugin
     is a piece of software containing a group of functions that can be added to a 
     WordPress website. They can extend functionality or add new features to your WordPress
     websites. WordPress plugins are written in the PHP programming language and integrate
     seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory
     [https://wordpress.org/plugins/](https://wordpress.org/plugins/) or can be cost-
     based plugin from a third-party. (like yours or Yoast) to my themes. I think this
     would better approach- but if theme authors do want to bundle it a Composer loadable
     option would be great.
 18. ![](https://secure.gravatar.com/avatar/19064ed4f839086c8fd557e5d00c62cdb52cdba868e6bf100a64d8a4f0974aed?
     s=32&d=mm&r=g)
 19.  [Mike Schinkel [WPLib Box project lead]](https://profiles.wordpress.org/mikeschinkel/)
     5:10 am _on_ June 27, 2019
 20. I vote **strongly against** the autoloader proposed.
 21. You are `spl_autoload_register()`ing yet another autoload function for each of`
     count($this->loaders)` **times** `count($collections)`.
 22. [https://github.com/WPTRT/autoload/blob/master/src/Loader.php#L102](https://github.com/WPTRT/autoload/blob/master/src/Loader.php#L102)
 23. This is very inefficient.
 24. CoreCore Core is the set of software required to run WordPress. The Core Development
     Team builds WordPress. should have **one** autoloader function — that only runs
     a tiny amount of code for each attempt to load a class file, **_(see below)_**—
     for all themes and for plugins) to use, and they should do it via a **class map**
     created with a build script just like themers create CSSCSS CSS is an acronym 
     for cascading style sheets. This is what controls the design or look and feel 
     of a site. from SCSS files today.
 25.     ```notranslate
         if (isset( self::class_map[$class_name])){ 
            require( "{$include_path}/{$class_name}.php" ); 
         }
         ```
     
 26. Every theme and every pluginPlugin A plugin is a piece of software containing 
     a group of functions that can be added to a WordPress website. They can extend
     functionality or add new features to your WordPress websites. WordPress plugins
     are written in the PHP programming language and integrate seamlessly with WordPress.
     These can be free in the WordPress.org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
     or can be cost-based plugin from a third-party. creating their own autoloaders
     is just a nightmare.
 27.  * ![](https://secure.gravatar.com/avatar/8013a62d7397c006bae48b96d6832a573ea71a7d5d3597fe584210567b508c05?
        s=32&d=mm&r=g)
      *  [Justin Tadlock](https://profiles.wordpress.org/greenshady/)  6:37 am _on_
        June 27, 2019
      * The TRT had no control over whether coreCore Core is the set of software required
        to run WordPress. The Core Development Team builds WordPress. will ever handle
        this. So, we’re left to our own devices. The two options available are helping
        make what we have better or talking a core lead into blessing an autoload feature.
         - ![](https://secure.gravatar.com/avatar/19064ed4f839086c8fd557e5d00c62cdb52cdba868e6bf100a64d8a4f0974aed?
           s=32&d=mm&r=g)
         -  [Mike Schinkel [WPLib Box project lead]](https://profiles.wordpress.org/mikeschinkel/)
           2:55 am _on_ June 28, 2019
         - The problem is not primarily the fact of implementing an autoloader but 
           instead the approach chosen. If theme — and pluginPlugin A plugin is a piece
           of software containing a group of functions that can be added to a WordPress
           website. They can extend functionality or add new features to your WordPress
           websites. WordPress plugins are written in the PHP programming language 
           and integrate seamlessly with WordPress. These can be free in the WordPress.
           org Plugin Directory [https://wordpress.org/plugins/](https://wordpress.org/plugins/)
           or can be cost-based plugin from a third-party. — vendors embraced this 
           you could end up with ten, twenty, thirty or more autoloaders being run.
         - I can somewhat agree with adding a preemptive autoloader, but I disagree
           with one that calls `spl_autoload_register()` for **Every. Single. Permutation.**_(
           Sorry for the emphasis, but this is a critical point.)_
         - Rather than just throwing stones I’ve submitted a pull request that fixes
           the bigger issues. It does not change the public APIAPI An API or Application
           Programming Interface is a software intermediary that allows programs to
           interact with each other and share data in limited, clearly defined ways._(
           although it does change the protected API; hopefully that is okay given 
           how new your code is.)_
         - Here: [https://github.com/WPTRT/autoload/pull/2](https://github.com/WPTRT/autoload/pull/2)
            * ![](https://secure.gravatar.com/avatar/8013a62d7397c006bae48b96d6832a573ea71a7d5d3597fe584210567b508c05?
              s=32&d=mm&r=g)
            *  [Justin Tadlock](https://profiles.wordpress.org/greenshady/)  1:43 pm
              _on_ June 28, 2019
            * And, that’s exactly what we’re after with this project–contribution for
              the benefit of all. Now, we need to get more devs doing the same.
            * The code is still in dev, so changing the protected APIAPI An API or 
              Application Programming Interface is a software intermediary that allows
              programs to interact with each other and share data in limited, clearly
              defined ways. is perfectly fine.
      * ![](https://secure.gravatar.com/avatar/d401f6723c24ce90038075be6a7990d02d2d7480fa3735f3697832fe393557d5?
        s=32&d=mm&r=g)
      *  [williampatton](https://profiles.wordpress.org/williampatton/)  8:15 pm _on_
        June 27, 2019
      * If you know a better way then please do teach us. I promise your contribution
        can benefit the whole community.
         - ![](https://secure.gravatar.com/avatar/19064ed4f839086c8fd557e5d00c62cdb52cdba868e6bf100a64d8a4f0974aed?
           s=32&d=mm&r=g)
         -  [Mike Schinkel [WPLib Box project lead]](https://profiles.wordpress.org/mikeschinkel/)
           2:56 am _on_ June 28, 2019
         - See [https://github.com/WPTRT/autoload/pull/2](https://github.com/WPTRT/autoload/pull/2)

### Leave a Reply 󠀁[Cancel reply](https://make.wordpress.org/themes/2019/06/24/feature-packages-update/?output_format=md#respond)󠁿

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fthemes%2F2019%2F06%2F24%2Ffeature-packages-update%2F&locale=en_US)
to post a comment.

This site uses Akismet to reduce spam. [Learn how your comment data is processed.](https://akismet.com/privacy/)

# Post navigation

[← Theme Review Team Meeting Agenda for June 25, 2019](https://make.wordpress.org/themes/2019/06/24/theme-review-team-meeting-agenda-for-june-25-2019/)

[Recap of the events at WCEU 2019 →](https://make.wordpress.org/themes/2019/06/25/recap-of-the-events-at-wceu-2019/)