I want to arrange my posts in a specific way, which first involves grouping them by month and year. However, I can't write the function to do for reasons that are probably simple that I am not getting.
Within a foreach(myposts) loop (included below), I've tried stripping the year from both the_date_xml and the_modified_date, but in both cases, all my function does is display the output of either of those. How can I get that output into a temporary variable to play with? Or How else can I get just "2008" from each post in a loop?
function display_travels(){
global $post;
$myposts = get_posts();
foreach($myposts as $post) :
if (the_modified_date(Y) == "2008") :
echo "IF TRUE";
endif;
endforeach;
}