in WordPress

What Does Your Wordpress Theme Support?

By default your Wordpress themes will support a number of features like these:

add_theme_support( 'custom-header' );

 The second parameter is optional but it allows you to set a number of different options on the image such as size.   

$defaults = array( 'default-image' => '', 'random-default' => false, 'width' => 0, 'height' => 0, 'flex-height' => false, 'flex-width' => false, 'default-text-color' => '', 'header-text' => true, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', ); add_theme_support( 'custom-header', $defaults );

## Enable Custom Background

 The same with **Custom backgrounds** before version 3.4 you needed to use the [function add\_custom\_background()](http://codex.wordpress.org/Function_Reference/add_custom_background "Wordpress custom background") but now you can just use the same function as custom header add\_theme\_support().   

add_theme_support( 'custom-background' );

 Again the parameters you pass into this function will allow you to set the options to the background image.   

$defaults = array( 'default-color' => '', 'default-image' => '', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $defaults );

## Enable Post Thumbnail

 By default you can set the featured image on the post but you would now be able to use the [function the\_post\_thumbnail](http://codex.wordpress.org/Function_Reference/the_post_thumbnail "The Post Thumbnail") if the theme does not support post thumbnails. To enable post thumbnails on your Wordpress theme you need to turn it on by using the following function.   

add_theme_support( 'post-thumbnails' );

 It is possible to just turn on post thumbnails for different post types, for example if you just want thumbnails turned on for posts or pages or custom post types then you can pass through this value as the second parameter.   

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', 'custom-post' ) ); // Posts and custom-post

 Now these are turned on you can display the thumbnails by using the **function the\_post\_thumbnail()**.   

if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail(); }

### Post Thumbnail Size

the_post_thumbnail('thumbnail'); // Thumbnail (default 150px x 150px max)

### Post Medium Size

the_post_thumbnail('medium'); // Medium resolution (default 300px x 300px max)

### Post Large Size

the_post_thumbnail('large'); // Large resolution (default 640px x 640px max)

### Post Other Sizes

the_post_thumbnail( array(100,100) ); // Other resolutions

 To automatically add a link around the post thumbnail you can do this by using this tutorial. [Add Link Around Post Thumbnail](http://www.paulund.co.uk/add-link-around-wordpress-post-featured-image)## Enable Automatic Feed Links

 Wordpress allows your visitors to easily subscribe to your [RSS feeds](http://www.paulund.co.uk/7-tips-to-improve-your-wordpress-rss-feed "7 Tips To Improve Your WordPress RSS Feed") by adding the link in the head tag of your theme. To turn this feature on you need to use the following function.   

add_theme_support( 'automatic-feed-links' );

## Check To See What Your Theme Supports

 If you are writing plugins then you need to make sure what the **current theme supports** before you can do something on the theme. To check if your current theme supports one of the following: - Custom headers
- Custom Backgrounds
- Post Thumbnails
- Menus
- Automatic Feed Links
- Editor Style
- Widgets

 You can use the [Wordpress function current\_theme\_supports().](http://codex.wordpress.org/Function_Reference/current_theme_supports "Current Theme Supports")   

<?php if (current_theme_supports('custom-header')) { // do something special when custom-header is supported... } ?>

<?php if (current_theme_supports('custom-background')) { // do something with custom backgrounds } ?>

<?php if (current_theme_supports('post-thumbnails')) { // do something with post thumbnails } ?>

<?php if (current_theme_supports('menus')) { // do something with Wordpress menus } ?>

<?php if (current_theme_supports('automatic-feed-links')) { // do something with your feed links } ?>

<?php if (current_theme_supports('editor-style')) { // do something with your editor styling } ?>

<?php if (current_theme_supports('widgets')) { // do something with Wordpress widgets } ?>

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email