Thank you for answering me @MWDelaney .
The links of the stores are not repeated, the name corresponds to the name of the store and the link corresponds to the link of the book for your purchase.
For example
*Amazon
*https://www.amazon.com/Los-Logos-8-Gestalten/dp/3899556941/
Thanks for helping me with my code, I was able to remove the undefined variable message, but I still can’t get the ACF repeater works. Can you help me?
Field Group
Year = Text Field (year)
Author = Text Field (author)
Stores = Repeater (stores)
-- Name = Text Field (name)
-- Url = Url Field (url)
app/controllers/front-page.php
public function books()
{
$book_items = get_posts([
'post_type' => 'book',
'posts_per_page'=>'10',
]);
return array_map(function ($post) {
return [
// Title, Content and Image
'title' => apply_filters('the_title', $post->post_title),
'content' => apply_filters('the_content', $post->post_content),
'thumbnail' => get_the_post_thumbnail($post->ID, 'large'),
// ACF Fields
'acf_year' => get_field('year', $post),
'acf_author' => get_field('author', $post),
// Repeater Store Name and Link
];
}, $book_items);
}
resources/views/partials/content-front-page.blade.php
@debug
@if($books)
@foreach($books as $book_item)
{!! $book_item['title'] !!}
{!! $book_item['acf_year'] !!}
{!! $book_item['acf_author'] !!}
{!! $book_item['content'] !!}
{!! $book_item['thumbnail'] !!}
// ACF Repeater
@endforeach
@else
Not found
@endif
Thanks Man!
Have a nice day.