locate_template with multiple categories?
The code you posted is looping through all the categories that the post is assigned. The foreach constructs a string representing every possible template file that it wants to check for and assigns them all to $template. The locate_template() function will go through the $templates array and return the first one of them that actually … Read more