Skip to content

Theme Support

Richard Coffee edited this page Apr 29, 2018 · 4 revisions

TCC_Theme_Support class

File: classes/Theme/Support.php

This class handles turning on wordpress theme support. By default, everything is turned on.

Generally, anything that requires a call to add_theme_support() is covered, along with content_width and theme_scandir_exclusions.

Properties

The class currently has three public properties

Default: 1600

Can be overridden using the filter 'fluid_support_content_width'.

Default: 'css/editor-style.css'

filter_prefix

Default: 'fluid'

A string that is used as a prefix for all applied filters, throughout this class.

Public Methods

Only the __construct method and the three hooked methods have public visibility. All other methods are protected.

__construct

Hooks into two actions, 'after_theme_setup' for method 'load_theme_support' and 'init' for method 'post_type_support', and hooks into one filter, 'theme_scandir_exclusions' for method 'theme_scandir_exclusions'.

load_theme_support

Runs on the 'after_theme_setup' action. Uses an array to determine which theme support methods should be run. This array can be filtered using 'fluid_load_theme_support'.

post_type_support

Runs on the 'init' action. Calls add_post_type_support for both posts and pages. Has three filters: 'fluid_theme_post_type_support' applied after the feature array is initialized, 'fluid_theme_post_type_support_posts' applied before the add_post_type_support call for 'post', and 'fluid_theme_post_type_support_pages' applied before the call for 'page'. The post and page filters are independent from each other, although 'page-attributes' is added to the array just before the 'page' filter is applied.

theme_scandir_exclusions

Adds some directories for WordPress to exclude when scanning for files. Add more directories to the list if WordPress is looking for page templates. IMPORTANT: Check the directories being returned by this method if your page templates are not being found.

Protected Methods

Most of the methods are named after the corresponding theme support option, with the dash being replaced by an underscore. Only the methods containing apply_filters calls are listed here.

filter: 'fluid_support_content_width'

filter: 'fluid_support_custom_background'

filter: 'fluid_support_custom_header'

filter: 'fluid_support_custom_logo'

filter: 'fluid_support_html5'

filter: 'fluid_support_post_formats'

This method also will add 'post-formats' to the array for 'post' in the method 'post_type_support'.

Provides an action, 'fluid_support_post_thumbnails', that can be used to add additional theme support for thumbnail sizes. This method also will add 'thumbnail' to the array for 'post' in the method 'post_type_support'.