• Resolved R3dRidl3

    (@r3dridl3)


    I would like to be able to pass on variables to the_flexible/get_flexible.
    This way I could for example set up a counter in my page.php and access (and increment) it within the template files.

Viewing 1 replies (of 1 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    the_flexible() and get_flexible() are just a replacements of the classic ACF way to render flexible content. ie: while(have_rows('flexible')): the_row();.

    You can pass variables using PHP global:

    single.php:

    $my_var = 'hello';
    the_flexible('my_flexible');
    

    /layouts/my-layout/template.php:

    global $my_var;
    echo $my_var; // hello
    

    Hope it helps!

    Regards.

Viewing 1 replies (of 1 total)

The topic ‘Feature request: Pass variable to the_flexible/get_flexible’ is closed to new replies.