This should be simple but I can't figure it out...I have this array in php:
Array ( [108] => WP_Post Object ( [ID] => 108 [post_author] => 1 [post_date] => 2020-07-17 19:25:21 [post_date_gmt] => 2020-07-18 00:25:21 [post_content] => [post_title] => Sight_to_See_paperback_final13-10-10-19 [post_excerpt] => [post_status] => inherit [comment_status] => open [ping_status] => closed [post_password] => [post_name] => sight_to_see_paperback_final13-10-10-19-2 [to_ping] => [pinged] => [post_modified] => 2020-11-29 16:09:42 [post_modified_gmt] => 2020-11-29 21:09:42 [post_content_filtered] => [post_parent] => 105 [guid] => https://legacytoo.com/wp-content/uploads/2020/07/Sight_to_See_paperback_final13-10-10-19-1.pdf [menu_order] => 0 [post_type] => attachment [post_mime_type] => application/pdf [comment_count] => 0 [filter] => raw )
How do I get the value of "108" in my code? Or, how do I get the guid value when I don't have the 108 value. I've get the array from this:
$query = array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'post_mime_type' => 'application/pdf');
$images = get_children( $query );
and I try to display it like this:
$thisVar = $images->guid;
and this
$thisVar = $images[0]->guid;
and neither works. This one works but again, I don't have the 108 value:
$thisVar = $images[108]->guid;
Thanks if you can help.
reset($images),reset()will give you the first element in the array.