How to use wp_get_attachment_metadata for thumbnails

The structure would be something like this. Check if you have a thumbnail Get the meta Add the meta data for w/h/file Then render the image if ( has_post_thumbnail() ) : // check if the post has a Post Thumbnail assigned to it. $upload_dir = wp_upload_dir(); $size=”full”; $post_thumbnail_id = get_post_thumbnail_id( $post_id ); $post_thumbnail_meta = wp_get_attachment_metadata … Read more

Change display of featured image for pages in twenty seventeen theme

You are struggling with wrong files. You can find post files in theme-folder/template-parts/post/content.php file. You’ll find this code you can add your classes or whatever in your child theme. <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <?php if ( is_sticky() && is_home() ) : echo twentyseventeen_get_svg( array( ‘icon’ => ‘thumb-tack’ ) ); endif; ?> <header … Read more

Add a featured image in my theme?

You need to add theme support in the functions.php file of your active theme like this: if ( function_exists( ‘add_theme_support’ ) ) { add_theme_support( ‘post-thumbnails’ ); } To enable it within a custom post type, you will need to do so when registering your post type with the supports argument, so you’ll need to add … Read more

Adding a custom field or metabox to the post-thumbnail widget?

Just filter admin_post_thumbnail_html and append your checkbox HTML: add_filter( ‘admin_post_thumbnail_html’, ‘wpse_71501_thumbnail_options’ ); function wpse_71501_thumbnail_options( $html ) { return $html . <<<html <p> <label for=”big_thumbnail”> <input id=”big_thumbnail” name=”big_thumbnail” type=”checkbox” /> Use big thumbnail </label> </p> html; }