New answers tagged

0

There's not enough info to be sure this answer is definitive but here's an attempt. Firstly make sure the image you are uploading is actually larger than the size you have defined. I see people upload images that are too small and then get this sort of result all the time. Secondly, WP will only make up a Srcset list of image sizes with the same aspect ...


-1

You need to define other sizes with this function


-1

Try this code , its working for me value=>'?' because(value was required for NOT EXISTS comparisons to work correctly prior to 3.9. You had to supply some string for the value parameter. An empty string or NULL will NOT work. However, any other string will do the trick and will NOT show up in your SQL when using NOT EXISTS.) For more information ...


0

Here are some thoughts : the_post_thumbnail() already echo so you cannot echo again you could use echo get_the_post_thumbnail() instead But in your case I don't really see why you use get_posts() most of the time we use it to get post data and make other treatments. You'd better use your own instance of WP_Query here like this : <?php $_posts ...


1

I assume you need to show the image url to the user, for all sizes, within the Attachment Details screen. Using Underscore/Backbone We can extend the Attachment Details View, in a similar fashion as in my previous answer here and based on the media views in the core: <!-- Custom template part --> <script type="text/html" id="tmpl-wpse-url-per-...


0

If i understood you correctly, you want the featured image to be displayed or not based on whether it was uploaded or not. If so, the basic code is: <?php if( has_post_thumbnail() ) { ?> <a href=<?php the_permalink(); ?>"><img src="<?php the_post_thumbnail(); ?>" title="<?php the_title(); ?>" /></a> <?php } ?> ...


0

You can overrule inline styles/attributes with !important: .wp-post-image { width: auto !important; /* or probably 100% in case of a grid */ height: auto !important; } It's not the cleanest solution, but it solves your problem.


1

This is mostly a PHP general question about concatenating a function's returned value with a (or many) string(s). The get_bloginfo function returns a string instead of echoing it directly. Thus you start off with: // First param value: stylesheet_directory // Using "template_url" also works unless you are using a child theme // In that case, "template_url"...


0

add_action('do_meta_boxes', 'remove_thumbnail_box'); function remove_thumbnail_box($post_type) { remove_meta_box( 'postimagediv', 'post.php', 'side' ); } Wordpress seems to only disable the featured images when calling action do_meta_boxes also use "post.php" as the post type instead of "post", I don't know why this is as it contradicts the ...


1

Here's one way to inject the custom field as the featured image caption with help of the post_thumbnail_html filter: add_filter( 'post_thumbnail_html', function( $html, $post_id ) { if( $html && $caption = get_post_meta( $post_id, 'wpcf-bildunterschrift', true ) ) $html .= sprintf( '<p>%s</p>', sanitize_text_field( $caption ) ...



Top 50 recent answers are included