Hi @littleshock,
Thanks for reaching out about this. The new Custom looper type does little more than give you a way on the PHP side to pass an array of items into the builder. This is very powerful, but does require you to code the integration yourself or work with a developer. Here are a couple of quick pointers:
- The custom looper filter expects you to return an array
- This array can contain a list of
WP_Post
, WP_Term
, associative arrays, or scalar values (strings numbers) but every item should consistently be the same type.
- If the items are
WP_Post
or WP_Term
you can use the respective Dynamic Content fields to access them.
- If the item is an associative array you can access the values inside each object with
{{dc:looper:field key="some_key"}}
- If the item is a scalar value you can use Looper > Current Item from Dynamic Content
- Inside your custom looper you’ll want to fetch all the data out of the plugin you’re using via whatever public API they make available.
- When you have that data available, you may need to process it somewhat to ensure what you are returning is an array of items.
Here’s a really simple code example. It expects the Custom Looper hook to be set to my_looper
add_filter( 'cs_looper_custom_my_looper', function( $result, $args ) {
$items = []; // populate this from your plugin
return $items;
}, 10, 2);
Hopefully this helps somewhat. We’re working on more videos about the subject - one of which will be a deep dive on coding custom PHP for loopers.
So while we can’t help you implement a 3rd party plugin integration, hopefully this advice gives you a starting point. You could also reach out to the developers of your plugin to see if they have any advice on retrieving the data you need.