Essentially, I am curious if it is possible to create a template part and inject html markup somewhere within that template part.
Currently I am accomplishing this by passing a variable, that contains my markup, to the template part. Example below:
<?php $markup = get_query_var("markup"); ?> <div class="container"> <?php echo $markup ?> </div>
<?php $markup = " <div>content</div> "; set_query_var("markup", $markup); get_template_part("partials/template-part"); ?>
However, I would prefer a method that would look similar to this (obviously I using fictional method names here):
<?php start_template_part("partials/template-part"); ?> <div>content</div> <?php end_template_part("partials/template-part"); ?>
Is there something similar in Wordpress that would allow me to accomplish the second method?