Get post featured image id with $wpdb

Haven’t tested it, but this should work: SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->terms.name, wpcflat.meta_value AS latitude, wpcflong.meta_value AS longitude, 6371 * 2 * ASIN ( SQRT (POWER(SIN(($lat – wpcflat.meta_value)*pi()/180 / 2),2) + COS($lat * pi()/180) * COS(wpcflat.meta_value *pi()/180) * POWER(SIN(($long – wpcflong.meta_value) *pi()/180 / 2), 2) ) ) AS distance, wpcfthumbnail AS thumbnail_id; FROM $wpdb->posts LEFT JOIN … Read more

Smaller thumbnail in the_content

I suspect you may be unclear about the code and features you are referring to and therefore about what you are asking. If you are trying to change the size of the thumbnail for an image you are inserting in the content area then you would change this in the Settings under Media as marikamitsos … Read more

Resizing old post thumbnail images

I’ve figured this out. Appears as though I really wanted add_image_size(‘post’, 475, 475, true); and then reran the Regenerate Thumbnails plugin. After sorting out a permissions error on /wp-content/uploads, this worked great. Then in my theme, I just displayed this image size for the post thumbnail. the_post_thumbnail(‘post’);

If no featured image, add one of the default images into DB

Im not sure about the random part. But to set a back up featured image if none is set just use <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } else { ?> <img src=”https://wordpress.stackexchange.com/questions/96146/<?php bloginfo(“template_directory’); ?>/images/default-image.jpg” alt=”<?php the_title(); ?>” /> <?php } ?> Or something like this without major template edits function autoset_featured() { global … Read more