How do I Get WordPress Featured image from Frontend
You can get the original size with the following: the_post_thumbnail( ‘full’ );
You can get the original size with the following: the_post_thumbnail( ‘full’ );
You should choose “full” under size on attachment display settings (right bottom) when inserting an image to get the full version. or you could always just remove the “-500×500” from the href
Not sure where you are running your code but the below will get the post type of video if it is set I think that WordPress returns false if there is no post type. // This will get the post id and then test for the format type global $post; $post_id = $post->ID; $post_format = … Read more
How to cropped thumbnail image without distorting it?
add_action(‘init’, ‘remove_plugin_image_sizes’); function remove_plugin_image_sizes() { remove_image_size(‘featured_large’); } The code needs to be added to the file functions.php
You could start by having a look at Post Thumbnails and how to enable them for your theme. You will need this to enable the functionality of setting a featured image for your post. This page is great for learning lots about how Post Thumbnails in WordPress work, you should really read all of it. … Read more
Try this code: <?php $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id,’full’, true); if ( !empty($thumb_url[0])) { echo “There is a thumbnail and it’s id is: “.$thumb_id; } else { echo ‘There is no picture.’; } ?> For the second code, use: <?php $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id,’full’, true); if ( !empty($thumb_url[0]) ) : ?> <img … Read more
Ok, it’s my fault. I’ve installed a “blank”-theme to have a blank frontend (because I only use the API) – but I didn’t realize that a theme changes something in the Admin Frontend. By adding this to the functions.php I re-enabled the box: add_theme_support(‘post-thumbnails’);
I clearly didn’t know how to google, as this page already explains how to do exactly what I wanted. Adapting it a bit, for it to work with different post types, I came up with the following: add_action(‘do_meta_boxes’, ‘replace_featured_image_box’); function replace_featured_image_box() { $post_types = array(‘bwps’, ‘page’, ‘post’); foreach( $post_types as $post_type ) { remove_meta_box( ‘postimagediv’, … Read more
Show a page of non-standard-sized featured images