Duplicated featured image is not showing
Duplicated featured image is not showing
Duplicated featured image is not showing
As suggested by @RobertWent, it was a simple matter of a CSS issue. A rogue display: flex; on the image container was the troublemaker, and once removed, the issue was resolved.
I don’t know if you’re still looking for a solution, but you can use the post_thumbnail_html filter in you php file to return a fallback; like so. /** * Set the default image if none exists. * * @param string $html The post thumbnail HTML. * @param int $post_id The post ID. * @param int … Read more
WordPress auto generates small medium and large of an image on upload, how can we guess their links?
You probably want to define a size for post thumbnails for this side-bar area first. This needs to be registered with your theme so you can refer to it later one. Then you can make use of the get_the_post_thumbnail() function passing the ID of the post as well as your post thumbnail size name as … Read more
I have found a solution by myself… I was installing a plugin called “Multiple Post Thumbnails” That is really quite useful…
Have a look at get_the_post_thumbnail. You can use that in your loop next to the post title.
Look at the wp-content/uploads/ directory. Does your cropped image exists there? (e.g. myimage-185×185.jpg). If not, you could try to call add_image_size() on the init action hook. functions.php function wpse27579_addImageSizes() { add_image_size(‘thumbnail-gallery’, 185, 185, true); } add_action(‘init’, ‘wpse27579_addImageSizes’);
You can use the_post_thumbnail() to output the thumbnail image directly. <?php $count = 1; ?> <?php while (have_posts()){ the_post(); ?> <article id=”<?php echo $post->post_name; ?>” class=”post<?php post_class(); ?>” itemscope itemtype=”http://schema.org/Article”><?php if ($count == 1 && has_post_thumbnail( get_the_ID() ) ){ the_post_thumbnail(‘blog-thumbnail’, array(‘class’ => ‘banner’, ‘item_prop’ => ‘image’)); } $count++; ?> <header> <h1 itemprop=”name”><a href=”https://wordpress.stackexchange.com/questions/35617/<?php the_permalink(); ?>” … Read more
I solved this by using this code function exclude_thumbnail_from_gallery($null, $attr) { if (!$thumbnail_ID = get_post_thumbnail_id()) return $null; // no point carrying on if no thumbnail ID // temporarily remove the filter, otherwise endless loop! remove_filter(‘post_gallery’, ‘exclude_thumbnail_from_gallery’); // pop in our excluded thumbnail if (!isset($attr[‘exclude’]) || empty($attr[‘exclude’])) $attr[‘exclude’] = array($thumbnail_ID); elseif (is_array($attr[‘exclude’])) $attr[‘exclude’][] = $thumbnail_ID; // … Read more