Load templates, pass arguments, and render output from functions.php

I can't seem to find a solution to actually loading a template, passing arguments to it, executing it, and displaying the results from a shortcode registered via functions.php

Is this even possible? I would like to have editable template parts that are not hard-coded into the function. I tried output buffer, but it still doesn't get anything from the get_template_parts() functions, so I had to return to outputting HTML from the function.

Edit: Would it be appropriate to just include/require the files, and capture them with output buffer? Is that appropriate for WordPress?

Topic get-template-part shortcode functions templates Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.