wordpress - Displaying All Data from Custom Post Type Fields through Advanced Custom Fields -


i have looked on google, trying figure out. i've made progress still stuck. i'm pretty new acf , custom post types. have custom post type of attorneys setup through wck. post type has field group field names of attorney_photo, attorney_name , attorney_areas_of_practice. code below, can attorney_name , attorney_areas_of_practice (repeater field) display, not attorney_photo. have info displaying correctly on each attorneys specific page, need page listing of attorneys. not sure doing wrong image part.

<?php get_header(); ?>  <?php $args = array(     'posts_per_page' => 30,     'order' => 'asc',     'orderby' => 'title',     'post_type' => 'attorneys' );  query_posts($args);  if ( have_posts() ) :   ?> <?php while ( have_posts() ) : the_post(); ?>  <div class="attorney-preview">  <?php $photo = get_post_meta($post->id,'attorney_photo', true); ?> <img src="<?php echo $photo; ?>" />  <p><strong><a href=""><?php echo get_post_meta($post->id,'attorney_name', true); ?></a></strong></p>  <ul> <?php     while ( have_rows('attorney_areas_of_practice') ) : the_row();         $attorney_area_of_practice = get_sub_field('attorney_area_of_practice');         echo "<li>" . $attorney_area_of_practice . "</li>";     endwhile;    ?> </ul>  </div><!-- .attorney-preview -->  <?php endwhile; ?>   <?php endif; ?>  <?php wp_reset_query();  // restore global post data stomped the_post(). ?>  <?php get_footer(); ?> 

when add image field through acf plugin there options of return value. example return value is: image object or return value is: image url, in case return value might selected image object, not image url. why here code being returned array rather url. image url array, please write following bit change:

<?php $photo = get_post_meta($post->id,'attorney_photo', true); ?> <img src="<?php echo $photo['url']; ?>" /> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -