wordpress featured image size too big Consider an image of dimension 1200px by 630px. Set featured images for individual posts is show Set featured images for individual posts as full, large, medium, thumbnail size. Add Featured Images or Post Thumbnails in the content area.
wordpress featured image size too big
How to Change Featured Image Sizes in WordPress? WordPress Featured Image Size. Best size is 1200 x 628 pixels.
Basic image settings
- The original size
- Thumbnail
- Medium
- Large
wordpress featured image size – WordPress Default Image Sizes
- Thumbnail size: 150Γ150 pixels
- Medium size: 300Γ300 pixels
- Large size: 1024Γ1024 pixels
The general syntax is wordpress featured image size,
add_image_size( string $name, int $width, int $height, bool|array $crop = false )
Changing The Featured Image Size
functions.php
set_post_thumbnail_size( 50, 50 ); // 50 pixels wide by 50 pixels tall, resize mode
choose to resize the image by cropping
set_post_thumbnail_size( 50, 50, true ); // 50 pixels wide by 50 pixels tall, crop mode
Adding Additional Image Sizes
Example
add_image_size( 'category-thumb', 300, 9999 ); // 300 pixels wide (and unlimited height)
<?php the_post_thumbnail( 'category-thumb' ); ?>
Link featured image to the post:
Open functions.php
simple Copy and paste the following code:
function wcs_auto_link_post_thumbnails( $html, $post_id, $post_image_id ) { $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>'; return $html; } add_filter( 'post_thumbnail_html', 'wcs_auto_link_post_thumbnails', 10, 3 );
and last Save changes.
Display Custom Sizes in Your Theme
Example
if ( has_post_thumbnail() ) { the_post_thumbnail( 'your-custom-size' ); }
add_filter( 'image_size_names_choose', 'my_custom_sizes' ); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'your-custom-size' => __( 'Your Custom Size Name' ), ) ); }
Set featured images for individual posts
plugin – WordPress Featured Image
<?php function featured_image_add_menu() { add_submenu_page ( "options-general.php", "Featured Image", "Featured Image", "manage_options", "set-featured-images-into-post", "featured_image_settings_page" ); } add_action ( "admin_menu", "featured_image_add_menu" ); function featured_image_settings_page() { ?> <div class="wrap"> <h1> Featured Image in Single Post : <a href="https://www.pakainfo.com/" target="_blank" rel="noopener">Pakainfo</a> </h1><br/><br/> <div class="postbox" style="width: 65%; padding: 30px;"> <form method="post" action="options.php"> <?php settings_fields ( "featured_images_into_post_config" ); do_settings_sections ( "set-featured-images-into-post" ); submit_button (); ?> </form> </div> </div> <?php } function featured_images_into_post_settings() { add_settings_section ( "featured_images_into_post_config", "", null, "set-featured-images-into-post" ); add_settings_field ( "set-featured-images-into-post-text", "Featured Image Settings size", "featured_images_options", "set-featured-images-into-post", "featured_images_into_post_config" ); register_setting ( "featured_images_into_post_config", "set-featured-images-into-post-text" ); } add_action ( "admin_init", "featured_images_into_post_settings" ); function featured_images_options() { ?> <?php $selected_futured_image = stripslashes_deep ( esc_attr ( get_option ( 'set-featured-images-into-post-text' ) ) ); ?> <select name="set-featured-images-into-post-text"> <option <?php if($selected_futured_image=='thumbnail'){ ?> selected <?php }?> value="thumbnail">Thumbnail</option> <option <?php if($selected_futured_image=='medium'){ ?> selected <?php }?> value="medium">Medium</option> <option <?php if($selected_futured_image=='large'){ ?> selected <?php }?> value="large">Large</option> <option <?php if($selected_futured_image=='full'){ ?> selected <?php }?> value="full">Full</option> </select> <?php } add_filter( 'the_content', 'featured_image_in_content_add_to_content' ); function featured_image_in_content_add_to_content( $content ) { $selected_futured_image = stripslashes_deep ( esc_attr ( get_option ( 'set-featured-images-into-post-text' ) ) ); if ( is_singular() && has_post_thumbnail() ) { return get_the_post_thumbnail( null, $selected_futured_image ) . $content; } else { return $content; } }
Don’t Miss : WordPress featured image size change