Hi, I’m trying to add a variable, get_field(‘campus_link’) to a custom post type function in my controller file, here’s my code:
public function campusLoop()
{
$campus = get_posts([
'post_type' => 'campus',
'posts_per_page'=>'-1',
'order' => 'ASC'
]);
return array_map(function ($post) {
return [
'content' => apply_filters('the_content', $post->post_content),
'excerpt' => apply_filters('get_the_excerpt', $post->post_excerpt),
'thumbnail' => get_the_post_thumbnail($post->ID, 'large'),
'thumbnail_url' => get_the_post_thumbnail_url($post->ID, 'large'),
'title' => $post->post_title,
];
}, $campus);
}
How would I add the ACF field in here and then display the data from that field in a view?
Thanks!