I am trying to loop over an array but I keep getting the same error :/
Anyone has any idea what I'm doing wrong here?
my array:
$data[]= array('title' => get_the_title( $id ),
'link' => get_the_permalink( $id ));
My loop:
<?php foreach ($data as $item): ?>
<p><a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></p>
<?php endforeach; ?>
I've dumped my array and it looks good so there's probably something wrong with my loop