Home › Forums › ACF PRO › add related content to get_posts query › Reply To: add related content to get_posts query
thanks John, do you mean creating a second array by the same structure and then merging both arrays? But then I should better use “Post Objects” instead of “Post IDs”, right?
edit: I got it by setting “Post Objects” and merging both arrays
$related = ( get_field(‘rel_content’) );
$result = array_merge($related, $posts);
Now I need only a way to order the result and render the
rel_content array first, before posts.
//Get Attributes
$args = shortcode_atts(
array(//Set default
'category' => 'common',
'order_by' => 'post_date',
'order' => 'DESC',
'limit' => 10,
'text_length' => 200,
'link' => 'true',
'slide_duration' => 2000,
'auto_start' => 'true',
'start_time' => 60000,
'cycle_time' => 10000,
'show_headers' => 'true',
'image_size' => 'large',
'thumbnail_size' => 'thumbnail',
'thumbnail_menu' => 'true'
),
$atts
);
Can I use the $args section to search for the rel_content fields and priorize that posts?
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.