Else/If Statement to Display Photo Descriptions

How about like this: <div style=”position: relative”> <?php the_post_thumbnail(‘large’); $imagedesc = get_post(get_post_thumbnail_id())->post_content; if(!empty($imagedesc)) { echo ‘<span style=”position:absolute; bottom:9px; right:0; color:#FFF; background:rgba(0,0,0,0.8); padding:4px 6px; font-size:0.7em”>’; echo $imagedesc; echo ‘</span>’; } ?> </div>

Make image full width

Use the following CSS to target only the banner image on single posts: body.sinlge .size-banner-image { width:100%; } This will only work if your <div class=”container”> element is not restricted in its width, else the banner will only stretch to the container width.

Couple of beginner’s questions [closed]

Check this: Check this: https://premium.wpmudev.org/blog/daily-tip-how-to-automatically-set-the-featured-image-in-wordpress/ http://dominiquej.com/how-to-delete-uncategorized-wordpress/ No, 301 redirects will typically not impact your performance in the SERPs negatively when done correctly. Please specify your question.

Show (print) featured image all dimensions (height, width)

Add this function to your functions.php file: function show($size = NULL) { global $post; $post_thumbnail_id = get_post_thumbnail_id( $post->ID ); if(isset($size)){ $image_data_array = wp_get_attachment_image_src($post_thumbnail_id,$size); }else{ $image_data_array = wp_get_attachment_image_src($post_thumbnail_id);//Default value: ‘thumbnail’ } echo $image_data_array[1].”x”.$image_data_array[2];//here you can add more chars of strings if you want } and use it like this: <a class=”classname” href=”https://wordpress.stackexchange.com/questions/256604/<?php the_post_thumbnail_url(“full’ ); ?>”>Full Image … Read more

How to add post thumbnail dynamically using Jquery?

js (edit 4) $(function() { $(‘body’).on(‘click’, ‘.post-link’, function() { // Jquery var ajax = {}; ajax.id= $(this).attr(‘rel’); var ajaxurl=”/wp-admin/admin-ajax.php”; jQuery.post( ajaxurl, { ‘action’: ‘get_img_post_and_title’, ‘data’: ajax }, function(response){ // add html if(response.success){ $(‘#post-cont’).append(“<li>ID: “+response.data.post_id+” “+response.data.post_title+” <img src=””+response.data.post_thumb+””/> –<a href=”#” class=”close”>X</a></li>”); } } ); }); }); php (edit 4) // php add_action(“wp_ajax_get_img_post_and_title”, “get_img_post_and_title”); add_action(“wp_ajax_nopriv_get_img_post_and_title”, “get_img_post_and_title”); function … Read more

Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?

Sorry, what you’re looking for is not an standard WordPress feature. It might interfere with the theme, which could be built to already include a link to the featured image. That would lead to invalid html. So you’ll have to build this yourself using the admin_post_thumbnail_html hook, which allows you to add fields to the … Read more