Thumbnails not showing in blog

The loop term in WP refers to concept of iterating over post objects and (typically) filling global variables with data of current one. It can be identified by one of: the_post() function calls (main loop) $some_variable->the_post() method calls (secondary loops using WP_Query object) setup_postdata( $post ) (more raw version, working with array of post objects) … Read more

the_post_thumbnail unless video id is added

I think all you need is this: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> if (get_field(‘channel’) == ‘Youtube’) { echo get_field(‘youtube_video_id’); } elseif (get_field(‘channel’) == ‘Vimeo’) { echo get_field(‘vimeo_video_id’); } elseif ( has_post_thumbnail()) { the_post_thumbnail(); } That should use a Youtube video, then a Vimeo video, then the thumbnail, … Read more

Hide feature image when is not populated

I guess the <div class=”single-post-thumb” > is the one with the border etc. Change your code to this: if ( has_post_thumbnail( ) ) { echo ‘<div class=”single-post-thumb” >’; tie_thumb( ”, $width, $height ); if ( get_post( get_post_thumbnail_id( ) )->post_excerpt ) { echo ‘<div class=”post_thumbnail-caption”>’ . get_post( get_post_thumbnail_id( ) )->post_excerpt . ‘</div>’; This will cause the … Read more

Displaying All Parent Pages as Featured Images

To get all the “root” pages of a site: $args = array( ‘post_type’ => ‘page’, ‘child_of’ => 0, ); $pages = get_pages( $args ); foreach( $pages as $page ) { if( has_post_thumbnail( $page->ID ) { $imgdata = wp_get_attachment_image_src( get_post_thumbnail_id(), ‘large’ ); $imgwidth = $imgdata[1]; // thumbnail’s width $imgheight = $imgdata[2]; // thumbnail’s height } } … Read more

Retrieve post thumbnails

<?php /* Template Name: Ron’s WordPress Answers Template */ include_once(‘header.php’); $args = array( ‘posts_per_page’ => 5, ‘offset’ => 0, ‘category’ => ”,//you have to use the category id # here not the name of the cat ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘suppress_filters’ => true ); $posts = get_posts( … Read more