Skip to:
Content
Pages
Categories
Search
Top
Bottom

"Use as featured image" missing from add media dialog


  • Philip John
    Participant

    @philipjohn

    I’m trying to add featured images to forums. I have successfully filtered the register_post_type call like so;

    /**
     * Add thumbnails to forums
     */
    function ys_forum_featured_images( $post_type ) {
         $post_type['supports'][] = 'thumbnail';
         return $post_type;
    }
    add_filter( 'bbp_register_forum_post_type', 'ys_forum_featured_images' );
    

    That did not, however add the meta box to the post edit page so I further used the following;

    /**
     * Add featured image meta box
     */
    function ys_bbp_featured_images(){
        add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', 'forum', 'side', 'low');
    }
    add_action('add_meta_boxes', 'ys_bbp_featured_images', 100);
    

    The meta box then appears but in the image details I see the “Insert into post” button and “Delete” link but no “Use as featured image” link.

    Any idea how I get that added?

    The only thing I could find were these tickets talking about the link appearing when it shouldn’t:

    http://bbpress.trac.wordpress.org/ticket/1633

    http://core.trac.wordpress.org/ticket/18669

Viewing 6 replies - 1 through 6 (of 6 total)

  • Philip John
    Participant

    @philipjohn

    I notice that I can link media items to forums, and this is shown in the media library as you would expect for posts. However, has_post_thumbnail() still returns false for the forum.

    I’ve never tried adding featured images to forums, but the first thing that comes to mind is that you do not need to add the meta box. The featured image meta box should be added automatically by WordPress when you add support for the images.


    Philip John
    Participant

    @philipjohn

    That’s just it: the meta box isn’t added. I filtered the arguments used by bbPress in register_post_type and dumped them to a file – I can see that thumbnail is there in the supports array but the meta box doesn’t appear.

    I’ve just tested this on my local bbPress and only the first snippet is needed. The meta box was added automatically and everything worked fine.

    It might be a theme conflict, have you tried switching to the default theme?


    Philip John
    Participant

    @philipjohn

    How very dumb of me… yes, it’s my custom theme. I could have sworn when I switched to Twenty Eleven with the same code I had the same problem.

    Thanks for taking the time to reply.


    FlipFlop
    Participant

    @flipflop

    Thanks for this guys, fantastic stuff. Should be included by default.

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.