Skip to content

Instantly share code, notes, and snippets.

@vdrnn
Created May 24, 2020
Embed
What would you like to do?
TeamOverview.php Controller
<?php
namespace App\Controllers\ContentModules;
trait TeamOverview
{
use \App\Controllers\Partials\ModuleTitle;
use \App\Controllers\Partials\Person;
protected function get_team_overview_data()
{
$args = array(
'post_type' => 'team-member',
'post_status' => 'publish',
'posts_per_page' => -1,
'facetwp' => true,
);
$loop = new \WP_Query( $args );
$team_members = $loop->posts;
$team_members_data = [];
foreach($team_members as $team_member) {
$team_members_data[] = [
'name' => $team_member->post_title,
'role' => $this->get_person_role($team_member->ID),
'image' => $this->get_person_image($team_member->ID), // TODO: Get square & smaller size
'link' => $this->get_person_link($team_member->ID),
];
}
$data = [];
$data['title'] = pll__('Team');
$data['titleSize'] = '5xlarge';
$data['content'] = $team_members_data;
return $data;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment