0

I am working on a theme and for some reason, add_theme_support( 'post-formats', ... ) is not working.

In my theme's functions.php I have the following near the top:

function mytheme_setup() {
    // ...other functions

    // Add post formats support
    add_theme_support( 'post-formats', array(
        'aside',
        'audio',
        'chat',
        'gallery',
        'image',
        'link',
        'quote',
        'status',
        'video',
    ) );

    // ... more other functions
}
add_action( 'after_setup_theme', 'mytheme_setup' );

add_post_type_support( 'post', 'post-formats' );

Yet, when I go to WordPress admin -> Posts -> Edit New Post or Add New Post, I do not see a box allowing me to select a post format. I tried putting add_post_type_support() inside mytheme_setup() function, but still the same result. Am I missing something?

  • What theme are you using Geoff? – Brad Dalton Feb 5 '14 at 8:11
  • @BradDalton This is a customized version of the Iconic One theme. I copied all Iconic One files to a folder iconic-one-custom to make modifications, so this is not a child theme. Yes, I realize I could've gone with child theming but there were some important modifications I had to make that were beyond the scope of child themes. – geoff Feb 5 '14 at 8:15
  • The code has been tested and also works in a parent theme. – Brad Dalton Feb 5 '14 at 8:34
  • add_post_type_support( 'my_custom_post_type', 'post-formats' ); is used to add post format support to different post types like custom post types and pages etc and not needed for the post type 'post' – Brad Dalton Feb 5 '14 at 8:42
  • Did my answer resolve your problem Geoff? – Brad Dalton Feb 5 '14 at 8:58
0

Add this to your child theme which over-rides what your parent theme supports.

Post Formats for Posts

add_action( 'after_setup_theme', 'wpsites_child_theme_posts_formats', 11 );
function wpsites_child_theme_posts_formats(){
 add_theme_support( 'post-formats', array(
    'aside',
    'audio',
    'chat',
    'gallery',
    'image',
    'link',
    'quote',
    'status',
    'video',
    ) );
}

And here's the result tested on the Twenty Twelve default theme.

enter image description here

You can also use the above code in your parent themes functions file however the 3rd parameter may not be needed.

To add Post Formats to OTHER Post Types, you'll also need to add one of the following code snippets on top of the code above.

Post Formats for Custom Post Types

To add Post Formats to Custom Post Types, also add this code to functions and swap cpt-name with the name of your Custom Post Type.

add_post_type_support( 'cpt-name', 'post-formats' );

Post Formats for Pages

To add Post Formats to Pages, also add this code in functions.

 add_post_type_support( 'page', 'post-formats' );
  • This is actually its own theme, which does not currently support post formats. I am trying to add post format support. – geoff Feb 5 '14 at 8:16
  • WordPress includes support for Post Formats built in. Its been tested in the Twenty Twelve Parent theme and works. All you need to do is display the meta box using the code above. – Brad Dalton Feb 5 '14 at 8:34
  • Very interesting, this wasn't working last night but now all of a sudden, it works. Thanks! – geoff Feb 5 '14 at 19:04
0

I had this same problem just now and was able to discover that it was solved by going up to the "Screen Options" dropdown in the upper-right of the admin page, next to the "Help" dropdown, and then checking the box next to "Excerpts". Adding the add_post_type_support function to your functions.php file apparently just enables this checkbox to show up in the admin, but it is unchecked by default, so you still must check it.

My apologies for answering an old post, but I did not see this answer mentioned here, and it is still quite relevant to other people who might be searching for an answer to this problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.