Setting featured image based on related post

I took a quick look at the Modern Tribe’s source code, particularly the single-event.php view template. MT is using an internal function, tribe_event_featured_image(), which includes a filter: tribe_event_featured_image. You could use this filter to see if MT has already found an image, and, if not, look up your own and return its value. add_filter( ‘tribe_event_featured_image’, … Read more

if statement for featured images

The second if statement requires it to be a post, so a 404 page won’t pass. I’d re-do it like this, using elseif statements. I also changed $thumbnail->ID to $post->ID since the former was not defined. add_action( ‘genesis_before_header’, ‘minimum_featured_image’ ); function minimum_featured_image() { global $post; if ( is_home() ) { echo ‘<div id=”featured-image-home”>’; echo get_the_post_thumbnail($post->ID, … Read more

Using lower resolution/size images for thumbnails on posts index

You will have to edit your theme files for that, but you can use the_post_thumbnail (Codex) to show the featured image in a smaller size. This is an example from the Codex which you can probably use 1 to 1: <?php if ( has_post_thumbnail() ) : ?> <a href=”https://wordpress.stackexchange.com/questions/189741/<?php the_permalink(); ?>” title=”<?php the_title_attribute(); ?>”> <?php … Read more

Generate smaller post thumbnail for archives

I think from your question you might want to look at adding a new thumbnail image size into your functions.php add_image_size( $name, $width, $height, $crop ); https://codex.wordpress.org/Function_Reference/add_image_size You’ll then need to regenerate the post thumbnails, as you’ve added a new image size, there is a plugin called “Regenerate Thumbnails” https://wordpress.org/plugins/regenerate-thumbnails/ Then you’ll need to set … Read more

Post thumbnail on specific template

You can use the remove_post_type_support for your requirement. In your case, you remove post thumbnail if specific page template is not selected. function remove_post_thumb(){ if (isset($_GET[‘post’])) { $post_id = $_GET[‘post’]; } else if (isset($_POST[‘post_ID’])) { $post_id = $_POST[‘post_ID’]; } else { return; } $template_file = get_post_meta($post_id, ‘_wp_page_template’, TRUE); if ($template_file != ‘page-your-template.php’) { remove_post_type_support(‘page’, ‘thumbnail’); … Read more

MySQL swap one table for another?

Create a php script ( fpw-swap-thumbnails.php ) with the code below and put it in root of your site: <?php // load WordPress environment require( ‘wp-load.php’ ); $args = array( ‘posts_per_page’ => -1, ‘post_type’ => array( ‘post’, ‘page’ ), ‘post_status’ => ‘publish’ ); // get all published posts of type specified in $args $posts = … Read more