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'

    Can I use the $args section to search for the rel_content fields and priorize that posts?