Always start with the Codex. According to the function reference for the_post_thumbnail()
:
Parameters
$size
(string/array) (Optional) Image size. Either a string keyword (thumbnail, medium, large, full), or any custom size keyword defined by add_image_size(), or a 2-item array representing width and height in pixels, e.g. array(32,32).
Default: ‘post-thumbnail’, which theme sets using set_post_thumbnail_size.
PLEASE NOTE: The crop does not work in Wp 3.0+. All that is needed for WP 3.0+ is the call for the thumbnail to post. Then proceed to media in the dashboard and set your thumbnail to crop to the size you wish to use.
You need to create your custom image size, via add_image_size( $name, $w, $h, $crop )
, and then call the_post_thumbnail( $name )
.
Related Posts:
- Stop WP from creating “Sample Page” and “Hello World!” post
- How to Create Editable Blocks of Text for the Homepage?
- Count how many posts in category
- Custom Single Post By Category
- Set Post Title to Read-only and Disable Permalink Slug Editor in Gutenberg
- how to get permalink using sql
- Adding Post Counts to Menu (Nav) Programmatically?
- how to display full post with pagination on home page
- Show chart in post using data passed as custom field
- Show One Category on Post
- Show post titles only on the homepage
- how to grab first link in post… and of course call it
- Custom colors for post rows based on post meta value
- Get all Youtube video’s from posts and embed them on a different page
- Get all posts by post_author
- Linking to page with all posts
- How can I highlight syntax like it appears on stackoverflow?
- What Defines What Category A Post Picks (if in multiple)
- Delete Post From Front-End and attachment permanently
- Add Category name to Post Title (h1)
- Every possible way to get data (posts) from WordPress
- Blogroll – Different layout for first post
- How to delete old posts’ edits to save space?
- When trashing a post, also trash related comments
- Image Insert into posts and pages not working after 3.2.1 update
- Blog Posts not showing title
- Show info to author only
- Display post category in foreach loop with category link
- IP camera jpg stream to post
- Is there a straight-forward way to iterate over all shortcodes in a post?
- Using custom post template
- Adding custom fields to bbpress reply form
- Display post option on frontend
- Post id algorithm in WordPress
- Show the content that is after the excerpt using child theme
- How to put link in twenty fourteen theme? [closed]
- Skip in WordPress Post ID’s, can this cause issues?
- Change target of view link in admin
- WordPress Comment posting problem
- Pasting code into WordPress post – LFs being eaten
- Insert sometext after first h3 in content
- Remove password protected posts from default RSS feed
- Why my wp_posts data is so huge?
- Why posts array is empty?
- How to disable the_excerpt from one post
- Blog post not showing title
- Category page when using static front page
- How do you search for a post or page with a certain url on the WordPress admin panel?
- How to check in functions.php if there is data in a WP_Query?
- why str_replace targeting pages instead just targeting post?
- Display the 2nd category name of a custom post type without error if its null?
- How to set a certain Custom Template to a Single Blog Post
- How to Featured content with images in home page?
- why the posts queried from sql is more than those showed on the page?
- how to display today’s most viewed posts order by custom meta “views”
- Keyboard shortcut for headings on safari
- Highlighting Current Category in the Archive and Feeds page
- Get current taxonomy and display query accordingly
- Is there a function to get post info for any publish_status by post ID?
- Optimal WP Web App Backend for mobile app development
- Change permalinks for posts & for custom post types
- Add static text to post URLs
- Display a specific category in a focused area of my site
- How to customize blog post titles to render a YouTube logo on posts with an embedded video?
- Post page overwrite the custom blog page
- Check if almost 10 year old – working code is up to date
- Post Image Gallery After Content Function messes with other content
- Updating post status via rest api
- Query custom post type custom meta key
- WordPress: Develop multiple posts with different data
- unable to display two post per page in wordpress front-page.php
- WP Ajax returning 0, can’t find action
- Remove pagination if search returns empty
- show image gallery in archives or category page
- Page with Category Returning 1
- Adding wordpress posts using phpmyadmin
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX
- Customizing URL slugs of Custom Post Type and Taxonomy make posts/pages 404
- How can I get post text from all posts on a WordPress news site?
- Use special template for the first post in the loop
- Allow reader to reorder posts for themselves (oldest first)
- Posting a comment redirects admin/users to blank page
- Is it possible to completely replace a post with an action/filter?
- Surrogate ID for posts, is there an alternative field in the posts table?
- Expired Post with More Recent Time Stamp?
- Post preview in iframe without saving the post
- Set post beginning date and final date
- How to get only current images of a post
- How do I get thumbnails?
- Latest Posts not in the right order
- Using Post ID and Page ID in same function
- Howto put advertising as post number 1,2,3 etc
- How to Include a common category in a custom Category Search
- How do I insert a custom field in a user submitted post?
- Viewing category won’t show up Custom post type posts
- Get attachment if matches a variable
- How to get if category has posts?
- How to automatically convert a form with HTML link into post
- how to change background color of my all post
- WordPress Post Updating is Not Working