How do I create a page template were I can query all the posts from the Custom Post Type - let's say - "project" and order the results by year, displaying the year value at the beginning of each group .
You don't need to create a page template to list the project post type, just go to /project/ and you'll have a full date ordered listing.
The template powering that page will be determined as follows:
So create an
Finally, on each post check to see if the year of the data has changed, and if so, echo the year out with whichever markup you please, and continue as usual, making note to echo the year out on the first project post.