You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to allow ordering of which templates get shown through a foreach loop, (essentially i'm building a slider thats generated through lots of template parts being pulled together, very specific use case but it has standard slides built into the plugin, then these will be overwritable within the theme)
however my foreach loop is only returning the final item foreach ($orderArr as $template_slug) { $my_template_loader->set_template_data( $userData )->get_template_part( $template_slug ); }
My orderArr is Array ( [0] => welcome [1] => slide1 [2] => slide2 )
However if i manually call the template parts $my_template_loader->set_template_data( $userData )->get_template_part( 'welcome' ); $my_template_loader->set_template_data( $userData )->get_template_part( 'slide1' ); $my_template_loader->set_template_data( $userData )->get_template_part( 'slide2' );
It all works as expected.
Any suggestions would be helpful
The text was updated successfully, but these errors were encountered:
I'm trying to allow ordering of which templates get shown through a foreach loop, (essentially i'm building a slider thats generated through lots of template parts being pulled together, very specific use case but it has standard slides built into the plugin, then these will be overwritable within the theme)
however my foreach loop is only returning the final item
foreach ($orderArr as $template_slug) { $my_template_loader->set_template_data( $userData )->get_template_part( $template_slug ); }
My orderArr is
Array ( [0] => welcome [1] => slide1 [2] => slide2 )
However if i manually call the template parts
$my_template_loader->set_template_data( $userData )->get_template_part( 'welcome' ); $my_template_loader->set_template_data( $userData )->get_template_part( 'slide1' ); $my_template_loader->set_template_data( $userData )->get_template_part( 'slide2' );
It all works as expected.
Any suggestions would be helpful
The text was updated successfully, but these errors were encountered: