Move shortcode param builder earlier in function

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