php in a shortcode

  1. First, get_footer() is meant to load page level template files,
    not post-level ones. You should be using get_template_part()
    instead.
  2. Shortcodes execute as a filter on the_content. Per the norms of
    all filters, they should return content, not echo it. echoing
    content will cause effects like you are seeing. Apparently, the
    template file you are loading with the shortcode is printing
    charaters to the screen instead of returning a string as it should
    be.
  3. I don’t know where you’ve read that about shortcodes and PHP but it
    is is sort of nonsense, at least as you’ve presented the case.
    Shortcodes virtually all do more, much more, than echo static
    strings– take a look at the Core gallery shortcode, for example. To do that, you need PHP.