Home › Forums › General Issues › Getting relationship field values into selectbox › Reply To: Getting relationship field values into selectbox
this plugin can be only 2 option for get list:
– get from a repeater field created in option page (ACF Pro)
– get from a post (single post ID)
i read again your problem, this field doesn’t for you.
you can create a small query like relationship field and then create you select list. something like this:
<?php $args = array(
'posts_per_page' => 5,
'offset' => 0,
'category' => '',
'orderby' => 'post_date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'post_status' => 'publish',
'suppress_filters' => true ); ?>
<?php $posts_array = get_posts( $args ); ?>
<select>
<?php foreach ( $dynamicposts as $post ) : setup_postdata( $post ); ?>
<option value="<?php echo get_permalink(); ?>"><?php echo get_permalink(); ?></option>
<?php endforeach; ?>
</select>
<?php wp_reset_postdata(); ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.