{"id":2792,"date":"2024-02-02T21:20:23","date_gmt":"2024-02-02T21:20:23","guid":{"rendered":"https:\/\/wpconsults.com\/?p=2792"},"modified":"2024-02-03T18:54:39","modified_gmt":"2024-02-03T18:54:39","slug":"comment-modifier-la-taille-de-limage-vedette-dans-wordpress","status":"publish","type":"post","link":"https:\/\/www.wpconsults.com\/fr\/comment-modifier-la-taille-de-limage-vedette-dans-wordpress\/","title":{"rendered":"Comment modifier la taille de l'image vedette dans WordPress ?"},"content":{"rendered":"\n<p>The size of a featured image depends on several factors, such as the theme, layout, and design of your WordPress site, as well as the dimensions and quality of the original image. <\/p>\n\n\n\n<p>However, a good starting point for your WordPress featured image size is <strong>1200 x 628 pixels<\/strong>. These dimensions tend to work well across WordPress themes and page layouts, and also look good when shared on social media feeds<\/p>\n\n\n\n<p><strong>To change your featured image size in WordPress, you can follow these steps:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to <strong>Settings<\/strong> &gt; <strong>Media<\/strong> in your WordPress dashboard.<\/li>\n\n\n\n<li>Under <strong>Image sizes<\/strong>, you can adjust the default values for <strong>Thumbnail size<\/strong>, <strong>Medium size<\/strong>, and <strong>Large size<\/strong>. These are the sizes that WordPress will automatically generate for every image you upload.<\/li>\n\n\n\n<li>If you want to add a custom size for your featured image, you can use the <strong>add_image_size()<\/strong> function in your theme\u2019s <strong>functions.php<\/strong> file. For example, you can add this code to create a new image size called <strong>featured<\/strong> with the dimensions of 1200 x 628 pixels:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"add_image_size( 'featured', 1200, 628, true );\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #50FA7B\">add_image_size<\/span><span style=\"color: #F8F8F2\">( <\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F1FA8C\">featured<\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #BD93F9\">1200<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #BD93F9\">628<\/span><span style=\"color: #F8F8F2\">, <\/span><span style=\"color: #BD93F9\">true<\/span><span style=\"color: #F8F8F2\"> );<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>The last parameter <strong>true<\/strong> means that the image will be cropped to fit the exact dimensions. You can set it to <strong>false<\/strong> if you want to preserve the original aspect ratio of the image.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>To use your custom image size for your featured image, you can edit your theme\u2019s <strong>single.php<\/strong> file (or any other template file that displays the featured image) and replace the default size with your custom size. For example, you can change this code:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"the_post_thumbnail( 'large' );\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #50FA7B\">the_post_thumbnail<\/span><span style=\"color: #F8F8F2\">( <\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F1FA8C\">large<\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F8F8F2\"> );<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>to this code:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"the_post_thumbnail( 'featured' );\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dracula\" style=\"background-color: #282A36\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #50FA7B\">the_post_thumbnail<\/span><span style=\"color: #F8F8F2\">( <\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F1FA8C\">featured<\/span><span style=\"color: #E9F284\">&#39;<\/span><span style=\"color: #F8F8F2\"> );<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>Save your changes and refresh your site. You may need to regenerate your thumbnails using a plugin like [Regenerate Thumbnails] to apply the new size to your existing images.<\/li>\n<\/ol>\n\n\n\n<p>By following these steps, you can change your featured image size in WordPress and optimize it for your site\u2019s appearance and performance. You can also experiment with different image sizes and formats to find the best fit for your site. For more information on WordPress image sizes, you can check out these resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a is=\"cib-link\" href=\"https:\/\/www.wpbeginner.com\/beginners-guide\/wordpress-image-sizes-beginners-guide\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Beginner\u2019s Guide to WordPress Image Sizes (+ Best Practices)<\/a><\/li>\n\n\n\n<li><a is=\"cib-link\" href=\"https:\/\/wordpress.com\/go\/tutorials\/controlling-wordpress-image-sizes\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">WordPress Image Sizes: A Quick Guide<\/a><\/li>\n\n\n\n<li><a is=\"cib-link\" href=\"https:\/\/kinsta.com\/blog\/wordpress-image-sizes\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Everything You Need to Know About WordPress Image Sizes<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>La taille d'une image en vedette d\u00e9pend de plusieurs facteurs, tels que le th\u00e8me, la mise en page et la conception de votre site WordPress, ainsi que les dimensions et la qualit\u00e9 de l'image originale. Cependant, un bon point de d\u00e9part pour la taille de votre image vedette WordPress est 1200 x 628 pixels. Ces dimensions ont tendance \u00e0 bien fonctionner...<\/p>","protected":false},"author":1,"featured_media":3246,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[7],"tags":[64],"class_list":["post-2792","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-tips-tutorials","tag-without-plugin-series"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.wpconsults.com\/wp-content\/uploads\/2024\/05\/WpConsults-Default-post-thumbnail-jpg.webp?fit=1280%2C720&ssl=1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pboFy3-J2","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/posts\/2792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/comments?post=2792"}],"version-history":[{"count":0,"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/posts\/2792\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/media\/3246"}],"wp:attachment":[{"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/media?parent=2792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/categories?post=2792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wpconsults.com\/fr\/wp-json\/wp\/v2\/tags?post=2792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}