Edited loop-metadata include

added resource category function
removed code from search.php and included loop-metadata.php