How to separate posts by categories?
In the loop you’ll want to get the posts terms. Then instead of echo’ing, return the output and group it into an array where the keys are the categories. Then loop through the grouped array and output your categories and related posts. Something similar to: // to hold and sort your output $categories = array(); … Read more