I think you misunderstand the purpose of get_template_part()
. It is a wrapper for locate_template()
, which itself is just a wrapper for include()
.
By calling get_template_part( 'loop', 'tag' )
, you are telling WordPress to look for/include a file based on the following priority:
- Child Theme
loop-tag.php
- Parent Theme
loop-tag.php
- Child Theme
loop.php
- Parent Theme
loop.php
If you need to modify the markup of the loop itself, then you simply need to modify the appropriate file, according to the above priority list – e.g. loop-tag.php
in your Theme or Child Theme.
You may need to create this file; if so, copy loop.php
, name the copy loop-tag.php
, and edit as necessary.