Tag Info

Hot answers tagged


You need to call get_post_thumbnail_id() with the ID of the post, not the post object. $importbookcoverid = get_post_thumbnail_id( $importbookpost->ID ); and you should be fine.


You are passing the complete post object to get_post_thumbnail_id() where as you should use just the post ID. You should also setup post data before using template tags Please see WP_Post to see all the available properties you can use in the post object foreach( $allbookposts as $post ) { setup_postdata( $post ); $tempbookname = strip_tags( ...


You can update the way image is displayed in template. in the page loop it will have something like this: <?php the_post_thumbnail(); ?> This grabs the featured image. You can wrap that in a conditional statement to check for whatever you like. This would show it in every category apart from catgory 3. <?php if ( !in_category( '3' ) ) : ?> ...

Only top voted, non community-wiki answers of a minimum length are eligible