0

I added a custom post type with thumbnail support. When I navigate to the custom post type in the admin backend and add a new one, I can add a featured image.

The problem is, when I click the link to select a featured image, the media library doesn't show in the same window as a popup but is just navigates to the link. (The media library is displayed over the entire screen as a page and not as a popup)

I used the following code to add my custom post type:

// Register Custom Post Type
function sponsors_custom_post_type() {

$labels = array(
    'name'                => _x( 'Sponsors', 'Post Type General Name', 'bluespeer' ),
    'singular_name'       => _x( 'Sponsor', 'Post Type Singular Name', 'bluespeer' ),
    'menu_name'           => __( 'Sponsors', 'mycpt' ),
    'parent_item_colon'   => __( 'Parent Item:', 'mycpt' ),
    'all_items'           => __( 'Alle Sponsors', 'mycpt' ),
    'view_item'           => __( 'Bekijk Sponsor', 'mycpt' ),
    'add_new_item'        => __( 'Voeg nieuwe Sponsor toe', 'mycpt' ),
    'add_new'             => __( 'Voeg toe', 'mycpt' ),
    'edit_item'           => __( 'Bewerk Sponsor', 'mycpt' ),
    'update_item'         => __( 'Update Sponsor', 'mycpt' ),
    'search_items'        => __( 'Zoek Sponsor', 'mycpt' ),
    'not_found'           => __( 'Geen Sponsor gevonden', 'mycpt' ),
    'not_found_in_trash'  => __( 'Geen Sponsor gevonden in prullemand', 'mycpt' ),
);
$args = array(
    'label'               => __( 'post_type_sponsors', 'mycpt' ),
    'description'         => __( 'Sponsors', 'mycpt' ),
    'labels'              => $labels,
    'supports'            => array( 'title', 'thumbnail', ),
    'hierarchical'        => false,
    'public'              => true,
    'show_ui'             => true,
    'show_in_menu'        => true,
    'show_in_nav_menus'   => true,
    'show_in_admin_bar'   => true,
    'menu_position'       => 5,
    'can_export'          => true,
    'has_archive'         => true,
    'exclude_from_search' => false,
    'publicly_queryable'  => true,
    'capability_type'     => 'page',
);
register_post_type( 'post_type_sponsors', $args );

}

// Hook into the 'init' action
add_action( 'init', 'sponsors_custom_post_type', 0 );

EDIT:

The following error was in the developer console: Uncaught TypeError: Object [object Object] has no method 'dialog'

This is causing the problem but I have not found a solution yet...

  • Are there any custom meta boxes registered for your custom post type that might interfere? Do you get any JavaScript errors? – tfrommen Mar 5 '14 at 12:48
  • I get the following error in the developer console: Uncaught TypeError: Object [object Object] has no method 'dialog' post-edit.js?ver=3.1.4:105 – Frederik Voordeckers Mar 5 '14 at 13:19
  • The dialog script is required by something and isn't being loaded perhaps. – helgatheviking Mar 5 '14 at 13:33
  • @helgatheviking: any idea how to solve it? – Frederik Voordeckers Mar 5 '14 at 13:59
  • 1
    Classic debug procedure. Switch to default theme and disable plugins until you determine the culprit. My guess is someone is poorly loading some scripts. – helgatheviking Mar 5 '14 at 15:12

Your Answer

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

Browse other questions tagged or ask your own question.