Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#12739 closed enhancement (fixed)

Create remove_theme_support() function

Reported by: nathanrice's profile nathanrice Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Themes Keywords: dev-feedback has-patch
Focuses: Cc:

Description

It would be nice to have a remove_theme_support() function. Many times, as a theme author, I would like to turn certain theme features "on" by default, but give the user (via a child theme) the option to turn the feature off.

In these cases, it would be nice to have a remove_theme_support() function they could use to do just that.

Attachments (2)

theme.php.diff (584 bytes) - added by nathanrice 15 years ago.
remove_theme_support-ugly.diff (2.0 KB) - added by nacin 15 years ago.
Patch blacklists internal theme support registrations. Also, it handles unregistering of post thumbnail support by post type.

Download all attachments as: .zip

Change History (9)

#1 @demetris
15 years ago

  • Cc dkikizas@… added

#2 @wpmuguru
15 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [13877]) add remove_theme_support(), props nathanrice, fixes #12739

#3 follow-up: @nacin
15 years ago

  • Keywords dev-feedback added; theme-support removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

I hadn't had the chance to comment here yet, and am only doing so in passing at the moment.

We use add_theme_support() internally in very interesting ways, that way we can use current_theme_supports() later on. That includes current_theme_supports('widgets') and 'editor-style', when in reality, you're never calling add_theme_support('editor-style') or 'widgets'. Instead, we use add_theme_support internally, calling it for example when a sidebar is registered.

remove_theme_support('widgets') will stop current_theme_supports() from working, but will not remove widgets.

If we do this, I guess we should probably blacklist certain ones such as background, widgets, etc.

#4 in reply to: ↑ 3 @nathanrice
15 years ago

Replying to nacin:

remove_theme_support('widgets') will stop current_theme_supports() from working, but will not remove widgets.

If we do this, I guess we should probably blacklist certain ones such as background, widgets, etc.

Blacklisting sounds good to me. Do we have a list of features that you guys want to blacklist?

@nacin
15 years ago

Patch blacklists internal theme support registrations. Also, it handles unregistering of post thumbnail support by post type.

#5 @nacin
15 years ago

  • Keywords has-patch added

Okay, patch attached that does two things. One, it adds a blacklist, which is currently widgets, custom-background, custom-header, and editor-style.

Two, it allows removal of support at the per-post-type level for post-thumbnails.

There are some issues with it, unfortunately. Post types won't be created until init, but this would be run by after_setup_theme.

#6 @nacin
15 years ago

There are solutions for this, mainly preventing them from mucking with deregistering post types from post-thumbnails, when post-thumbnails was not registered for specific post types initially. Too late for 3.0 for now. Implementing the blacklist.

Workaround:

remove_theme_support('post-thumbnails');
add_theme_support('post-thumbnails', array( $ptypes_you_want ) );

#7 @nacin
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [13902]) Add blacklist to remove_theme_support(). fixes #12739.

Note: See TracTickets for help on using tickets.