Switch the method of calling the galleries in code.

By using `do_action()` instead of wrapping things in a
`function_exists()` the code to be inserted into templates is far
simpler, and more extensible.