php - Wordpress post thumbnail url is not working correctly -
i have issue website built on wordpress.
i'm trying display post thumbnail blog's page it's not working expected...
here :
<?php $loop = new wp_query( array( 'post_type' => 'post', 'posts_per_page' => 9) ); while ( $loop->have_posts() ) : $loop->the_post(); $thumbnail = get_field( 'thumbnail' ); $category = get_the_category(); ?> <a href="<?php echo get_permalink(); ?>"> <section class="col-lg-4 col-md-6 col-sm-6" style=" background-image:url(<?php echo $thumbnail['url']; ?>);"> <div class="article-head"> <h2><?php echo the_title(); ?><br><span><?php echo the_time(get_option('date_format')); ?></span></h2> </div> </section> </a> <?php endwhile; wp_reset_query(); ?>
so here is... i'm using acf (advanced custom field) plugin add image field called "thumbnail".
<?php echo $thumbnail['url']; ?>
this supposed give me thumbnail url... current page url http://robeen.ca/blog/. don't understand why...
can guys me ?
get_field()
returns object (array of data), url (string), or id (int). can changed in field settings. var_dump()
return value see what's inside.
see docs details.
Comments
Post a Comment