• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
WPFeed

WPFeed

  • News
  • Tutorials
    • WordPress Multisite
    • BuddyPress
    • Design
  • Reviews
    • Plugins
  • Roundups
  • Snippets
  • Giveaways
Home » BuddyPress » Add New Featured Image Sizes To WordPress

Add New Featured Image Sizes To WordPress

Featured-Images

By default, every image uploaded via WordPress Media manager will be uploaded to different sizes. However, when displaying them as featured image, the image needs to be re-sized or cropped to get the desired size. This code should go in your functions.php file of your child theme (Yes, I strongly recommend you to use a child theme to make any customization to your theme).

Here is the parameter you need to register a new size of the featured image:
For more details, see the WordPress Codex.

<?php 

// Add new featured image size

add_image_size( $name, $width, $height, $crop ); 

?>

The last parameter, $crop is should be set to TRUE for hard cropping. By default, it returns false.

Here are some examples:

<?php

// Add new featured image sizes

 add_image_size( 'grid-thumbnail', 236, 157, TRUE );
 add_image_size( 'single-post-thumbnail', 236, 236, TRUE );
 add_image_size( 'video-small', 110, 73, TRUE );

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • WordPress is a brilliant platform that is loaded with tons of stuff for websites.
  • How to Sync Stock & Price for WooCommerce Products
  • How to migrate a WooCommerce Store to a new site
  • How to Import WooCommerce Products
  • How to export WooCommerce Orders

Copyright © 2023 · WPFeed.com - A Project of TechAbout LLC.

  • About us
  • Advertise
  • Write for us
  • Terms and Conditions
  • Privacy Policy
  • Contact us