Image Alignment on Featured Images

Short answer: you don’t. The alignment settings only apply to images that the user adds to the Post Content. The Featured Image is incorporated into the template and is not added by the user to the Post Content. The Featured Image is directly integrated into the template, usually as a “post thumbnail” displayed on archive … Read more

Resizing thumbnails retrospectively

I never had much luck with that AJAX plugin either, but ViperBond’s Regenerate Thumbnails works perfectly for me on a number of sites: viper007bond.com/wordpress-plugins/regenerate-thumbnails It manages several thousand images on my server, albeit somewhat slowly, although you can also run it on individual images or batches of images from the Media library. If you have … Read more

get_the_post_thumbnail wordpress 3.5

I could be mistaken, but I don’t think $post->post_id works to retrieve the post’s ID. I believe you want $post->ID. So that was probably your issue to begin with, though without seeing your $attr array, it’s hard to say. Here’s a reference for $post‘s properties. In this case, get_the_post_thumbnail is the more appropriate function. In … Read more

Child Category Image

You can get a random post by category by using the following code: query_posts( array ( ‘showposts’ => 1, ‘orderby’ => ‘rand’, ‘cat’ => $cat->term_id ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); … And then use get_the_post_thumbnail() to retrieve the post featured image: if ( has_post_thumbnail() ) $image = … Read more

Getting img src from thumbnail_id using javascript

I haven’t tested this, but you’ll probably get the gist of it anyway: add_action(‘wp_enqueue_scripts’, ‘send_image_source_to_js’); function send_image_source_to_js() { global $post; // Does this post have a featured image? If yes, fetch the link / source $has_image = $source = false; if($thumb_id = get_post_thumbnail_id($post->ID)) { $has_image = true; $source_array = wp_get_attachment_image_src($thumb_id, array(300,300)); $source = $source_array[0]; } … Read more

Add Image Size for Featured Image with Responsive Design

You can wrap the image in a figure. <!– html –> <figure class=”constrained-container”> <img src=”https://wordpress.stackexchange.com/questions/100091/my-image.jpg” alt=”What my image is about”/> </figure> Then style the figure as well as the image. /* css */ .constrained-container { height: 300px; overflow: hidden; /* this hides excess of the image */ } .constrained-container img { display: block; width: 100%; … Read more

images not showing despite using add_theme_support(‘post-thumbnails’);

Since you appear to be using Featured Images, replace this: <div class=”post-image”> <?php echo ravs_get_custom_image( get_post_thumbnail_id () ); ?> </div><!– end post-image –> with this: <div class=”post-image”> <?php if ( has_post_thumbnail() ) { the_post_thumbnail( ‘custom-image’ ); } ?> </div> References Codex: has_post_thumbnail() the_post_thumbnail()

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)