add_theme_support

Definition:
function add_theme_support( $feature ) {}

Allows a theme to register its support of a certain feature
Must be called in the theme’s functions.php file to work. If attached to a hook, it must be after_setup_theme. The init hook may be too late for some features.

Parameters

  • string $feature: the feature being added

Source code

function add_theme_support( $feature ) {

	global $_wp_theme_features;



	if ( func_num_args() == 1 )

		$_wp_theme_features[$feature] = true;

	else

		$_wp_theme_features[$feature] = array_slice( func_get_args(), 1 );



	if ( $feature == 'post-formats' && is_array( $_wp_theme_features[$feature][0] ) )

		$_wp_theme_features[$feature][0] = array_intersect( $_wp_theme_features[$feature][0], array_keys( get_post_format_slugs() ) );

}

373

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: