Replace above foreach:
Take an array of objects ([0], [1], [2] ...) and set (each) as a special instance of $ pagedet.
foreach($portfolio_children as $pagedet) {
Now create the variable $ post_title equal to the value 'post_title' of each object in the array.
$post_title = $pagedet->post_title;
This will technically work, but you want to program each instance programmatically without identifying each object in the array.
echo $pagedet[0]->post_title; echo $pagedet[1]->post_title; echo $pagedet[2]->post_title;
Now you can write each post_title value:
echo $post_title; };
Finally
foreach($portfolio_children as $pagedet) { $post_title = $pagedet->post_title; echo $post_title; };
Jacob Robertson
source share