Will current_theme_supports()
return TRUE with a nonstandard add_theme_support()
string?
If I do this in my theme:
add_theme_support( 'my_funky_new_thing' );
Can someone else writing a plugin do this?
if( current_theme_supports( 'my_funky_new_thing' ) ){
// ...
}
Will current_theme_supports()
return TRUE with a nonstandard add_theme_support()
string?
If I do this in my theme:
add_theme_support( 'my_funky_new_thing' );
Can someone else writing a plugin do this?
if( current_theme_supports( 'my_funky_new_thing' ) ){
// ...
}
Share
Improve this question
edited Jun 28, 2019 at 19:14
Matthew Brown aka Lord Matt
asked Jun 27, 2019 at 23:00
Matthew Brown aka Lord MattMatthew Brown aka Lord Matt
1,0683 gold badges13 silver badges34 bronze badges
2 Answers
Reset to default 2Yes. You can take advantage of this to enable or disable features in your plugin if a theme does or does not declare support for a feature. WooCommmerce is an example of a plugin that does this.
As a side note for those interested, you can also pass parameters with your custom theme support.
// theme functions.php
add_theme_support( 'some_feature', array(
'arg_foo',
'arg_bar'
) );
// plugin.php
$feature_args = get_theme_support( 'some_feature' );
var_dump( $feature_args );
// array(
// array(
// 'arg_foo',
// 'arg_bar'
// )
// );