Don’t use get_template_part
. Instead use
include( locate_template( 'your-template-part.php' ) );
This will make your variables available to the included file without having to use the global keyword.
Don’t use get_template_part
. Instead use
include( locate_template( 'your-template-part.php' ) );
This will make your variables available to the included file without having to use the global keyword.