Instead of wading through lines of code when activating optional WordPress core functions like translation, custom backgrounds and logos, HTML5 integration, or post thumbnails, we’ve put together this handy add_theme_support WordPress snippet generator to do the heavy lifting for you.
To use the tool, simply click “Support” on the feature you’d like activated, then fill out the relevant fields below the box to further customize the feature, when modifiers are available. When you’ve added everything you’d like, copy the code and paste it into the functions.php file. That’s all there is to it!
Let’s dig into the add_theme_support function to get a sense of what you can do with this powerful code resource.
What does “add theme support” mean?
When you build out a theme, there many core WordPress functions that you can choose whether or not to opt into. Sometimes you may not want to include all the functions, as they may not be compatible with an older theme, or you just don’t need the feature. By using the add_theme_support feature, you are choosing to register specific WordPress core functions so they display in the user admin interface. In plain English, it’s a way of declaring, “This is my theme, and I want to use ____ feature and ____ feature.” That’s the gist of the add_theme_support feature.
As an example, one of the features available through the add_theme_support function is translation. In the particular declaration, you add theme support for translation functionality and then declare your text-domain and the location of the directory where the translation files should reside. If you don’t include these attributes, WordPress won’t try to find anything translatable about the theme.
You will find that there are many enhanced customization options available for each of these features, which can be called up using the default arguments. I’ve included all possible options for each theme support feature, and by clicking “Support” in the snippet generator, these options will appear. The code will populate and build on itself as you click through the options and enter your modifiers.
Register Theme Support Features
Here’s a list of WordPress support features that you can register by using the add_theme_support feature. You will see all of these listed as elements that can be activated in the theme support snippet generator tool tabs above:
List of Available Features
- Post Formats: This allows post formats to be incorporated into your theme and includes aside, gallery, link, image, quote, status, video, audio, and chat. If you are including this as part of a child theme, this will override parent theme formatting.
- Post Thumbnails: These are the featured images for a post or page and can be displayed throughout the site in a variety of manners using the post thumbnail option. Note that, in the snippet generator above, you can choose which dimensions you want the post thumbnails displayed at as well.
- Custom Background: This feature allows for inclusion of custom backgrounds. You can also choose to include default arrays – see here for the full list of custom background options, all of which can be included by clicking the “Support” option in the snippet generator.
- Custom Header: Allows custom headers. Here’s the full list of header arrays you can customize via the snippet generator.
- Custom Logo: Enables users to upload a custom logo. Click here for additional argument options. By clicking “Support” in the generator, you will find the rest of the attributes available for modification.
- Feed Links: This option activates Automatic Feed Links so they can be used for RSS feeds for posts and comments in the <head>.
- HTML5: This feature enables HTML5 markup for the comment list, comment form, search form, gallery and caption.
- Title Tag: Adding this feature lets the theme control the title-tag.
- Customize Selective Refresh Widgets: You can opt to selectively refresh widgets instead of having to refresh the entire page when working with the Customizer.
About the code output and adding to theme
When you output the code, you will want to paste it into your functions.php file. We always recommend to be sure to backup your site and use FTP so that in case there’s an error, you can fix it quickly with the old file.
We hope this tool helps condense the time spent on adding these integral WordPress theme support features into your functions.php file.