This code works fine and returns two StdClass Objects for each of my two posts:
$children = get_pages($args);
foreach ($children as $cake=>$element) {
$args = array(
'post_id' => $ID
);
$Comments = get_comments( $args );
};
This is great. I get each comment's properties but I am only interested in the comment date. My desired output is:
$CommentDates = (date1, date2, etc) -- Eventually I'd like to get the most recent comment date.
My next move is:
foreach ($Comments as $CommentObject) {
$CommentDates = $CommentObject->comment_date;
}
This returns only one date and it happens to be the second object's value.
However, if I simply echo this foreach, I get both dates.
foreach ($Comments as $CommentObject) { echo $CommentObject->comment_date; }