I'm having issues with images getting badly compressed when uploaded to my site. It's not an issue with photographs, but is very noticeable for images with solid blocks of colour and text. I've uploaded a PNG with a solid grey background overlaid with white text, and it's being badly compressed when WordPress resizes it to the various alternative sizes. Original image Large featured image size Unfortunately I don't have enough reputation to post more than 2 links, but you can …
I want to use the REST API of wordpress to build a new version of a custom theme. I'm able to get the json response of a particular category, but I need to find a way to obtain also the featured image or the second post thumbnail registered using a plugin, so I can use them in the layout. Is this possible without using a plugin? here is the code I'm using for testing: <script> (function($){ $(document).ready(function(){ $.getJSON('https://localhost/wordpress/wp-json/wp/v2/posts?category_name=portfolio&per_page=50&_embed', function(response){ console.log(response); …
i was thinking if there was anyway to add a okay icon overlay for video post types, i already came up with a code that allows me set up a default thumbnail if post has no thumb, sample code below. <div class="img-responsive"> <?php if ( has_post_thumbnail() ) : ?> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('big-grid-one-image'); ?></a> <?php else : ?> <img src=" <?php echo get_template_directory_uri (); ?>/img/no-thumb/acardio-548px-450px.png" /> <?php endif; ?></div>
I have a site with loads of posts (news items). Some posts don't have featured images yet. Adding the images to those posts (few hundreds) is a tedious task. We basically want to add 1 and the same image to all the posts without a featured image. Is there a way to do this in bulk? Like ADD 'this image' to ALL 'posts' (not pages) WHERE 'featured_image' is empty. I really hope there's a plugin for that. Can't find it …
i'm working on a WordPress plugin and i'm trying to display/get the post thumbnail below the post on my "Related posts" part. I tried many things which are supposed to work but not for me ... here is the code (on my plugin.php file): add_theme_support( 'post-thumbnails', array( 'post', 'page' ) ); if ( has_post_thumbnail() ) { echo ('there is a thumbnail'); echo get_the_post_thumbnail(get_the_ID(), "thumbnail"); // nothing echo get_the_post_thumbnail(); // nothing echo var_dump(get_the_post_thumbnail(get_the_ID(), "thumbnail")); //string '' (length=0) echo var_dump(get_the_post_thumbnail()); //string '' …
Wordpress compresses jpeg files to a lvl 82 quality. Should I upload my files in 100 quality to avoid double compression? Or will Wordpress know the file is already compressed and will skip this process? I usually save my files in photoshop in 80 quality , as progressive. Thank you
While showing all the posts together in admin panel, I have a custom column 'Featured Image'. And this column has a value YesOrNO. To set the column name : I have inside functions.php: function set_column_heading($defaults) { $defaults['featured_image'] = 'Featured Image'; return $defaults; } add_filter('manage_posts_columns', 'set_column_heading'); In order to set the column value, I have : function set_column_value($column_name, $post_ID) { if ($column_name == 'featured_image') { $post_featured_image = get_featured_image($post_ID); if ($post_featured_image) { echo 'YesOrNO'; } } } function get_featured_image($post_ID) { $post_thumbnail_id = …
I moved my WP website from shared hosting, to Digital Ocean LEMP stack droplet. I noticed that thumbnails aren't generated any more for new post featured images, I also tried manually regenarating thumbnails for specific images, it succeeds but nothing generated. I tried deactivation of the Force Regenerate Thumbnails plugin and activating it again, but still no luck. Any ideas?
I'm new to Wordpress and how Child themes work. My child theme I am trying to overwrite two files in sub-directories. I've copied the parent files and edited them in child theme but changes are not reflected in parent theme. I'm trying to change the code for feature image sizes. I successfully changed the code in parent to test it and it works. But child theme isn't overriding it. /public_html/wp-content/themes/sahifa/framework/functions/theme-functions.php /public_html/wp-content/themes/sahifa-child/framework/functions/theme-functions.php /public_html/wp-content/themes/sahifa/framework/parts/related-posts.php /public_html/wp-content/themes/sahifa-child/framework/parts/related-posts.php Other question I had was do I …
Is there any possibility to get featured post title and image using the JSON API. I tried using this: example.com/?json=the_post_thumbnails&count=3 But instead of recent posts, I get featured posts.
How can I edit the featured image? Usually I upload the image in media, there is one option which says "use as a featured image". This works fine but the output image is badly cropped. I want to know how can I manually crop it (150 x 150) and use that a featured image?
is there a way / function to determine if Get the image plugin successfully grab the image from post? Something like has_post_thumbnail on WordPress featured image. I need to know if featured image exist, since other HTML elements (position absolute) / depend on the Featured image for positioning. Thanks.
i Use WordPress Media Uploader on Frontend to allow users to upload Thumbnail for there UGC site. I also show a Preview of the Image on Frontend. When a user clicks the button the Media Uploader opens user uploads image, sets it as Featured Image and we are good. But, the Image Preview still shows old Image. I have a WordPress Site, based on User Generated Content, where people can create posts via a Frontend Form. When A user updates …
I'm making a limitation for image upload based on @brasofilo excellent snippet. In short, it limits user to only uploading image with minimum dimension. However I want to apply this only when user is uploading a featured image. I tried using $pagenow as a conditional, global $pagenow; if ($pagenow == 'media-upload.php') add_filter( 'wp_handle_upload_prefilter', 'wpse_28359_block_small_images_upload' ); But it doesn't work. Any idea here?
I want to keep different image on the single post type page and a different image if the post type is showing in a loop. Is there any way? Perhaps we can use the gallery image as featured on single view but if so, how?
I want to query 6 posts, but only those which have a featured image attached. I am using meta_key method for this with WP_Query as such: $args = array( 'post_type' => 'post', 'meta_key' => '_thumbnail_id', 'post_count' => 6 ); $query = new WP_Query($args); Followed by <?php while($query->have_posts()) : $query->the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_post_thumbnail('thumbnail'); ?> <?php endwhile; ?> This doesn't seem to work. The query is returning more than 6 posts and also those which don't have a featured …
It looks like I will need to create custom PHP code for this and either add it to my includes directory within a custom PHP file, or to the functions.php file. I need the ability to use a featured image in a post and be able to also dynamically display that same image in a gallery on the frontpage. I am not a PHP master by any means, but I know a bit to get around. My guess is I …
I have my site hosted with NetworkSolution, and they have a sql database size limit of 300MB. IF the size exceeds this limit we cannot access the wordpress admin dashboard. So currently its showing 441MB, and its overlimit. And they are force me to upgrade the database size to 1GB for 120$/yearly. But previously I had all tables size totaling to 45MB, but the database size was 321MB, and I had to request them to grant me access, so they …
I'm trying use wordpress core responsive image feature but it's not adding srcset to image. Here is th my codes I have a div w=370px h=280px now I added image sizes if(function_exists('add_image_size')){ add_image_size( 'imagebox', 370, 280, true ); add_image_size( 'imagebox-2x', 840, 560, true ); add_image_size( 'imagebox-3x', 1110, 840, true );} And calling it inside the loop like this the_post_thumbnail('imagebox-2x'); it's adding only image like this 2x version without srcset <img width="840" height="560" src="http://localhost/starter/wp-content/uploads/2018/10/04004_theblackandwhiterocky_2560x1600-840x560.jpg" class="attachment-imagebox-2x size-imagebox-2x wp-post-image" alt=""> If I remove …