How do I get the URL of the image in a single image field. If I use <?php foreach($pages as $p): ?><?php echo $p->team_image; ?><?php endforeach; ?> it gets the ID of the image. How do I get the URL instead?
Also if I use `<?php echo $p->permalink; ?>' it gets the URL of the main post and not the link of the current item in the loop. How do I get the link of the current item?
If I'm using a loop like this <?php foreach($teams as $p): ?> and while in the loop I use get_permalink() it gets the permalink of the parent post instead of the current post in the loop. How would I get the permalink of the current post in the loop?