Printing views exposed sort criteria separately to exposed filters
If you can not use each item of $widgets in separated way, you can push each widget in a separated array for use each widget across your custom html.

&lt;?php foreach($widgets as $id =&gt; $widget): ?&gt;
    &lt;?php
    array_push($elements, $widget);
    ?&gt;  
&lt;?php endforeach; ?&gt;

&lt;?php
echo $elements[0]-&gt;widget;
echo $elements[1]-&gt;widget;
//etc
?&gt;