• Resolved spoonofmilk

    (@spoonofmilk)


    The good news is I’ve been able to get ALM working nicely with an Advanced Custom Fields relationship field. I’m getting the post IDs from the ACF field, imploding them into a comma delimited variable which I can pass into the shortcode.

    Working at https://bit.ly/1oJlz8l

    The code I’ve used is:

    <?php
    	$ids = get_field('page_selected_projects');
    	$ajaxposts = implode(', ', $ids);
    	echo do_shortcode('[ajax_load_more post_type="projects" post__in="'.$ajaxposts.'" posts_per_page="8" orderby="menu_order" preloaded="true" preloaded_amount="8" button_label="Show more projects" scroll="false"]');
    ?>

    The problem I’m getting is ordering the posts by the order in which they are placed within the ACF field. The array of IDs in $ajaxposts is in the right order (outputting as “79, 78, 266, 123…”, but I can’t find the right way of getting ALM to recognise the order of the post IDs, it just wants to do it by date.

    Any ideas? Have I missed something really obvious?

    https://www.ads-software.com/plugins/ajax-load-more/

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘ALM with ACF Relationship Field Ordering’ is closed to new replies.