Dynamic content is not interpreted in looper params

Hi,

On an archive layout, I’ve set up a Hook with following params as I’ve seen dynamic content can be passed through Looper params if it’s between double quotes :

{
  "id":"{{dc:archive:id}}"
}

But when I try to display my ID from within my hook, I only get Array ( [id] => {{dc:archive:id}} ) and not the actual ID, could you tell what I’m doing wrong?

Hello @deciplex,

Thanks for writing in! Can you please include the code of your custom Looper Provider hook so that we will get a clear idea of what is it that you are trying to return for the Looper?

Best Regards.

Hi @ruenel,
I finally managed to catch the DC value with cs_dynamic_content() but I’m wondering if there’s not a better solution. Here’s the code, it’s quite basic :slight_smile:

// Get avis by formation id
add_filter(‘cs_looper_custom_avis_by_formation’, function($result, $args)
{
if (isset($args[‘id’])) {
$formationId = cs_dynamic_content($args[“id”]);
}
else{
$formationId = get_query_var( ‘cat’ );
}

 $query = array(
       'post_type'=> 'avis',
       'post_status'=>'publish',
       'posts_per_page'=>-1,
       'hide_empty' => 0,
 );
$avis = get_posts($query);
return $avis;

}, 10, 2);

Hi @deciplex,

Glad that you are able to find it.

Thanks

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