Move shortcode param builder earlier in function

This fixes #2284  but will likely cause conflicts with #2339