Creating a post object field

Anil kumar

The post object field contains options to customize your field:

  • Post type: You can filter the choices by selecting post types.
  • Filter from Taxonomy: You can filter the choices even more by selecting specific taxonomies / categories
  • Multiple: By ticking the multiple option, the select field will now allow multiple selections and the API will return an array instead of a single value.
  • Allow Null?: If selected, the select list will begin with a null value titled “- Select -”


<?php $postObjects = get_field('post_objects'); if($postObjects){ ?> <h3 class="section-title widget-title">THIS IS A NEWS ITEM ABOUT…</h3> <?php foreach($postObjects as $post){ setup_postdata($post); ?> <div> <div class="post"> <div class="mediaholder"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php the_post_thumbnail('full'); ?> </a> </div> <div class="detailholder"> <h4 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <?php the_excerpt(); ?> </div> </div> </div> <?php } wp_reset_postdata(); }// IMPORTANT - reset the $post object so the rest of the page works correctly ?>

Leave a Comment

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt