wordpress featured image size – 1200 x 628 pixels(Best WordPress Featured Image Size & Best Practices)
wordpress featured image size – 1200 x 628 pixels(Best WordPress Featured Image Size & Best Practices)
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.
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.webronix.com/" target="_blank" rel="noopener">webronix</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;
}
}
</pre-->
<p>Don't Miss : <a href="https://www.webronix.com/set-featured-images-for-individual-posts/" target="_blank" rel="noopener">WordPress featured image size change</a></p>
<h3><span class="ez-toc-section" id="Our_Latest_Best_WordPress_Plugin"></span>Our Latest Best WordPress Plugin<span class="ez-toc-section-end"></span></h3>
<ul>
<li><a href="https://wordpress.org/plugins/remove-yellow-bgbox/" target="_blank" rel="noopener">Remove Yellow BGBOX</a></li>
<li><a href="https://wordpress.org/plugins/bank-ifsc-code/" target="_blank" rel="noopener">Bank IFSC Code</a></li>
<li><a href="https://wordpress.org/plugins/new-tab-redirect-plus/" target="_blank" rel="noopener">New Tab Redirect Plus</a></li>
<li><a href="https://wordpress.org/plugins/set-featured-images-for-individual-posts/" target="_blank" rel="noopener">Set featured images for individual posts</a></li>
<li><a href="https://wordpress.org/plugins/4cgandhi/" target="_blank" rel="noopener">4cgandhi</a></li>
</ul>
<div class="yarpp yarpp-related yarpp-related-website yarpp-template-list">
<!-- YARPP List -->
<div class="addthis_inline_share_toolbox"></div> <h3>Related posts:</h3><ol>
<li><a href="https://www.webronix.com/set-featured-images-for-individual-posts/" rel="bookmark" title="Set featured images for individual posts">Set featured images for individual posts</a></li>
<li><a href="https://www.webronix.com/wp_get_attachment_image_src-wordpress-function/" rel="bookmark" title="wp_get_attachment_image_src – WordPress Function">wp_get_attachment_image_src – WordPress Function</a></li>
<li><a href="https://www.webronix.com/pagination-wordpress/" rel="bookmark" title="pagination wordpress – How to make PHP wordpress Pagination With Example and Demo">pagination wordpress – How to make PHP wordpress Pagination With Example and Demo</a></li>
<li><a href="https://www.webronix.com/wp_get_attachment_image_url/" rel="bookmark" title="PHP wp_get_attachment_image_url wordpress function">PHP wp_get_attachment_image_url wordpress function</a></li>
<li><a href="https://www.webronix.com/how-to-edit-footer-in-wordpress/" rel="bookmark" title="how to edit footer in wordpress – Remove the Branded Footer on Your WordPress Website">how to edit footer in wordpress – Remove the Branded Footer on Your WordPress Website</a></li>
<li><a href="https://www.webronix.com/wordpress-responsive-image-slider/" rel="bookmark" title="Responsive image gallery with thumbnail carousel Slider wordpress plugin">Responsive image gallery with thumbnail carousel Slider wordpress plugin</a></li>
<li><a href="https://www.webronix.com/image-upload-custom-code-in-wordpress/" rel="bookmark" title="how to upload images in wordpress by custom code?">how to upload images in wordpress by custom code?</a></li>
</ol>
</div>