How can I see where in my themes and plugins certain image sizes are used?
I would use my text editor to do a find in folder for each image size, starting with post-thumbnail. If non are found, then they aren’t being used.
I would use my text editor to do a find in folder for each image size, starting with post-thumbnail. If non are found, then they aren’t being used.
You can get the width and height of the image size set back from the global $_wp_additional_image_sizes array via the image size slug, so that: global $_wp_additional_image_sizes; $size=”featured-image”; $width = $_wp_additional_image_sizes[$size][‘width’]; $height = $_wp_additional_image_sizes[$size][‘height’]; Then in your template just change the image attributes: <img src=”https://wordpress.stackexchange.com/questions/217134/<?php bloginfo(“template_directory’); >/images/thumb_featured_img.jpg” width=”<?php echo $width; ?>” height=”<?php echo $height; ?>” … Read more
You’re not quoting your HTML attributes – one section should be: if ( has_post_thumbnail() ) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID)); echo “<a href=”https://wordpress.stackexchange.com/questions/217333/$link”><img src=”$image[0]” width=”98″ height=”80″ class=”img-responsive” /></a>”; } else { echo “<img src=”$url” >”; } …the other should be: echo “<h3><a href=”https://wordpress.stackexchange.com/questions/217333/$link”>”; the_title(); echo “</a></h3>”; echo “<div class=”post-meta”><span class=”date-meta”>On <a href=”https://wordpress.stackexchange.com/questions/217333/$link”>”; the_time( get_option( ‘date_format’ ) … Read more
I figured it out. Using the Genesis framework, you can do this, adapted from http://dreamwhisperdesigns.com/genesis-tutorials/genesis-default-thumbnails/ /** * Default Image * * @author Jen Baumann * @link http://dreamwhisperdesigns.com/?p=429 */ add_filter(‘genesis_get_image’, ‘dream_default_image’, 10, 2); function dream_default_image($output, $args) { global $post; $slug = $post->post_name; $thumbnail=”http://foodiefun.imgix.net/featured/”.$slug.’.jpg?fit=fill&bg=f9f9f9&w=400&h=600′; switch($args[‘format’]) { case ‘html’ : return ‘<img src=”‘.$thumbnail.'” class=”alignleft post-image” alt=”‘. get_the_title($post->ID) .'” … Read more
Use wp_get_attachment_image() instead if you want to set a class property. Example: $image = wp_get_attachment_image( get_post_thumbnail_id(), array(100, 100), true, array(‘class’ => ‘your-class-name’) ); //returns the HTML for the attachment echo $image; The above function returns the HTML img tag: <img src=”http://example.com/path/to/image.jpg” class=”your-class-name”/> You can see the difference between functions here: https://developer.wordpress.org/reference/functions/wp_get_attachment_image/ https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/
The easiest way to achieve this is to use the Multiple Post Thumbnails plugin. Once you have done this, add the following snippet to your functions file: if (class_exists(‘MultiPostThumbnails’)) { new MultiPostThumbnails(array( ‘label’ => __(‘Secondary Featured Image’, ‘yourtextdomain’) ‘id’ => ‘secondary-image’, ‘post_type’ => ‘post’ )); } This will make a box ‘Secondary Featured Image’ available … Read more
How to write conditional for custom checkbox in featured image meta box
Forcing a user to crop the featured image in a certain aspect ratio
Featured Image Not Working when loaded from sub-domain
This code will happen when you update the key name. File: wp-content/plugins/advanced-custom-fields/core/fields/_functions.php 193: foreach( array(‘key’, ‘name’, ‘type’) as $key ) 194: { 195: // run filters 196: $value = apply_filters(‘acf/update_value/’ . $key . ‘=’ . $field[ $key ], $value, $post_id, $field); // new filter 197: } Try to: print $value, $post_id, $field to understand what … Read more