Home › Forums › General Issues › Warning whith Relationship Fields › Reply To: Warning whith Relationship Fields
Hi !
I find this solution with query !
This code work perfectly.
` $sidebar = get_field(‘sidebar-widget’);
$args = array(
‘post_type’ => ‘sidebar-widget’,
‘page_id’ => $sidebar
);
$query = new WP_Query( $args );
// The Loop
?>
<?php if($query->have_posts()) : ?>
<?php while($query->have_posts()) : ?>
<?php $query->the_post(); ?>
<?php include(‘widget/content-sidebar-widget.php’); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>`
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.