Issue with wordpress thumnails – same thumnail displayed everywhere

I’m guessing the problem is this: $recent_posts[0][‘ID’]; and I don’t see $recent_posts being defined in your code, so what exactly is that $recent_posts and where/how did you define it?: $image = wp_get_attachment_image_src( get_post_thumbnail_id($recent_posts[0][‘ID’]), ‘full’ ); And you’re inside The Loop, so you could just call get_post_thumbnail_id() without having to specify the post ID — or … Read more

How to automatically add first image of post as thumbnail?

Please try the code given below: function auto_featured_image() { global $post; if (!has_post_thumbnail($post->ID)) { $attached_image = get_children( “post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1” ); if ($attached_image) { foreach ($attached_image as $attachment_id => $attachment) { set_post_thumbnail($post->ID, $attachment_id); } } } } // Use it temporary to generate all featured images add_action(‘the_post’, ‘auto_featured_image’); // Used for new posts add_action(‘save_post’, ‘auto_featured_image’); add_action(‘draft_to_publish’, ‘auto_featured_image’); … Read more

featured image background

You can try wp_get_attachment_image_src this for getting Feature Image URL. Here is the Full code. <?php function propertunity_featured_post() { $featured_post_id = 2860; $featured_post = get_post($featured_post_id); $featured_post_url = get_permalink($featured_post_id); $featured_post_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($featured_post_id, ‘thumbnail’) ); echo “<div class=”card”> <div class=”card-header” style=”background-color: #f8f8fc; overflow: hidden;”> <a href=”” . $featured_post_url . “”> <div class=”card__image” style=”background-image: url(” ” . … Read more

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