By default, WordPress gives you a list of the theme support functionality. The function of these theme support is to implement some special features inside a custom theme. To activate this theme support functionality, add_theme_support() is used. All the modern WordPress theme uses this powerful add_theme_support() function. In this tutorial, we will show you how can you add Theme Features in WordPress using add_theme_support Function.
Guide to adding Theme Features in WordPress using add_theme_support Function
If you are a beginner theme developer then you must learn the add_theme_support function. If your theme lacks some important features like post thumbnail, custom logo, custom header and custom background features then you can use this function to add these features to your pre-made theme. The add_theme_support() function is the pre-made hook of WordPress that helps theme developers to easily activate theme support for any given feature.
The general syntax of the function is
add_theme_support( string $feature );
Here the $feature is the required parameter which includes a feature to be added.
This function works only inside the theme’s function.php file. You can call the add_theme_support() right away in the function file without using an action. If you are creating a plugin and want to use this function outside the functions.php file then you must attach it to a hook called ‘after_theme_setup’.
Let’s take a look at various features which you can activate through this function.
Post thumbnail
This feature enables the Post thumbnail support for a theme.
add_theme_support( 'post-thumbnails' );
You can also pass a second optional argument with an array of post types for which you want to enable this features.
add_theme_support( 'post-thumbnails', array( 'post' ) ); // Posts only
add_theme_support( 'post-thumbnails', array( 'page' ) ); // Pages only
add_theme_support( 'post-thumbnails', array( 'post', 'movie' ) ); // Posts and Movies
Now, whenever you add or edit any post you can see the featured image meta box on the right bottom of your edit post or add post page.
Custom Background
This Custom_Backgrounds support for a theme can be enabled using this feature.
add_theme_support( 'custom-background' );
Custom Header
The Custom_Headers support for a theme can be enabled using this feature.
add_theme_support( 'custom-header' );
Once the custom header and custom background feature are activated in your theme, you can find a link under the Appearance menu.
Custom Logo
This feature provides the support for Theme Logo.
add_theme_support( 'custom-logo' );
Feed Links
With the help of this feature, you can enable Automatic Feed Links for post and comment in the head.
add_theme_support( 'automatic-feed-links' );
HTML5
This is a special feature which allows the use of HTML5 markup for the comment forms, comment lists, search forms, gallery, and caption.
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );
Title Tag
You can use this feature in order to enable plugins and themes to manage the document title tag. This should be used in place of wp_title() function.
add_theme_support( 'title-tag' );
Customize Selective Refresh Widgets
With this feature, you can enable the Selective Refresh for Widgets. The Selective Refresh for Widgets is managed within the Customizer. To find out more about how Selective Refresh works, read Implementing Selective Refresh Support for Widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
Conclusion
Most of the above-mentioned theme support can accept a group of optional arguments. These arguments will give you even more control. If you want to dig a little more into this then we suggest you visit add theme support on WordPress.org. We hope the article helped you with adding Theme Features in WordPress using add_theme_support Function. You can also read our other article on “Beginners Guide on Learning WP_Query“.
Related Posts

Kantiman Bajracharya

Latest posts by Kantiman Bajracharya (see all)
- What are Different WordPress Theme Licensing Terms? - December 21, 2017
- 4 Tips to Optimize Your WordPress for Social Media Share - November 30, 2017
- What is WordPress? Is WordPress Free? Why is WordPress so popular? - November 22, 2017