%PDF- %PDF-
Direktori : /var/www/html/atv-api/wp-content/themes/atv/inc/controllers/ |
Current File : /var/www/html/atv-api/wp-content/themes/atv/inc/controllers/homepageController.php |
<?php class Homepage { public function index($request) { $homepage = get_fields(10); $tours = getPosts('tours'); $rents = getPosts('rent'); $posts = getPosts('post'); $toursArr = []; foreach($tours as $tour) { $toursArr[] = [ "title" => get_the_title($tour->ID), "image" => get_the_post_thumbnail_url($tour->ID), "description" => get_field('description_home', $tour->ID), "bullets" => get_field("bullets", $tour->ID), "single_price_label" => get_field("single_price_label", $tour->ID), "price" => get_field("price_eur", $tour->ID), "double_price_label" => get_field("double_price_label", $tour->ID), "double_price" => get_field("double_price_eur", $tour->ID), "slug" => $tour->post_name ]; } $rentArr = []; foreach($rents as $rent) { $rentArr[] = [ "title" => get_the_title($rent->ID), "brandImage" => get_field("brand_image", $rent->ID), "image" => get_the_post_thumbnail_url($rent->ID), "bullets" => get_field("bullets", $rent->ID), "slug" => $rent->post_name ]; } $postsArr = []; foreach($posts as $post) { $postsArr[] = [ 'title' => get_the_title($post->ID), 'date' => get_the_date('F d, Y', $post->ID), 'slug' => $post->post_name, 'image' => get_the_post_thumbnail_url($post->ID) ]; } $homepage['tours'] = $toursArr; $homepage['rents'] = $rentArr; $homepage['posts'] = $postsArr; return $homepage; } }