Custom Looper Provider Arguments with Dynamic Content

I run into the same issue as this:

I have these arguments:

{
    "post_type" : "plaatsen",
    "post_parent" : "{{dc:post:id}}",
    "posts_per_page" : -1
}

When I count the characters in the $args[‘post_parent’] it returns 14 characters exactly the same as the value in params: {{dc:post:id}}. So it’s counting the characters of the dynamic content tag instead of the value that is returned.

I managed to found a solution by searching through the Looper Provider classes in the theme files and found out how you are getting the offset of the looper provider:

$offset = intval( cs_dynamic_content( $element['looper_provider_array_offset'] ) );

So i used the function cs_dynamic_content() to get the dynamic content and

add_filter( 'cs_looper_custom_dynamic', function( $result, $args ) {
    if ( isset( $args["post_parent"] ) ) {
        $args["post_parent"] = intval( cs_dynamic_content( $args["post_parent"] ) );
    }
    return get_posts( $args );
}, 10, 2);

Hi @100leiden,

Glad that you are able to find a solution.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.