0

I really like the WordPress' Twenty Seventeen theme's featured image upload where you can crop an image that with the set 2000x1200 dimensions. However, I haven't found a way to duplicate the feature for custom post types. Any ideas?

enter image description here

0

I have a partial solution where I can add a image crop uploader to the theme customization page. I have yet to figure out how to attach it to acf.

function add_my_media_controls($wp_customize) {

$wp_customize->add_section( 'theme_banner_image', array(
    'title'         => __( 'Banner Image', 'theme_banner_image' ),
    'priority'      => 35,
) );

$wp_customize->add_setting('banner_image', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint'
));

$wp_customize->add_control(new WP_Customize_Cropped_Image_Control($wp_customize, 'banner_image', array(
    'section' => 'theme_banner_image',
    'label' => 'Banner Image',
    'width' => 2000,
    'height' => 1200
)));
}
add_action('customize_register', 'add_my_media_controls');

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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