get_the_post_thumbnail() – Invalid argument supplied for foreach() in /wp-includes/post-thumbnail-template.php on line 64

This Trac ticket here describes your problem and the cause: https://core.trac.wordpress.org/ticket/26321 I got a warning/error related to update_post_thumbnail_cache() function: Warning: Invalid argument supplied for foreach() in ./wp-includes/post-thumbnail-template.php on line 64 The $wp_query->posts array is missing, but we have the single $wp_query->post. foreach ( $wp_query->posts as $post ) { if ( $id = get_post_thumbnail_id( $post->ID ) … Read more

How can I make thumbnails a display different size/position if the blog post was posted before a specific date?

In what way is it affecting your post thumbnails? I cleaned up your code a bit. If you can show me the output you’re getting I’ll be able to help you further. <?php global $post; $compare_date = strtotime( “2018-03-01” ); $post_date = strtotime( $post->post_date ); if ( has_post_thumbnail() ) { if ( $compare_date < $post_date … Read more

Display featured image as post thumbnail

Try this code. Then temporarily set permissions to the cache folder to 774 and the timthumb.php file to 750, you can increase or decrease the permissions as you see fit (or aslong as it stops working, then it’ll be time to loosen up the permissions). <?php // If there are images get them if ( … Read more

Source problem for children page image

Never mind about my question… here is your answer Put this function on your functions.php // Get Featured Image Path function get_featured_image_link($size){ global $post; $get_featured_image_link = get_the_post_thumbnail($post->ID, $size); preg_match(“/(?<=src=[‘|\”])[^’|\”]*?(?=[‘|\”])/i”, $get_featured_image_link, $thePath); return $get_featured_image_link_final = $thePath[0]; } Then this is the process to get the image… <?php $the_query = new WP_Query( array( ‘post_parent’ => ’20’, ‘post_type’ … Read more

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