function display_relevant_resources() { $display = get_field("display", get_the_ID()); if ($display[0] == 1) { $resource_ids = get_field("resources", get_the_ID()); $resources = array(); foreach ($resource_ids as $resource_id) { $resource = new Resource($resource_id['resource']->ID); $resource_JSON = $resource->toJSON(); $resource_object = json_decode($resource_JSON); $resources[] = new DetailedListItem($resource_object->title, $resource_object->description, $resource_object->link, array("link_label" => $resource_object->link_label, "tag" => ucwords(str_replace(array("-"), " ", $resource_object->type)))); } $Detailed_List = new DetailedList($resources); $Detailed_List->slider(); } }
function get_recent_resources() { $args = array('post_type' => "marketing_material", 'post_status' => 'publish', 'posts_per_page' => 10); $resources = new WP_Query($args); $detailed_list_args = array(); if ($resources->have_posts()) { while ($resources->have_posts()) { $resources->the_post(); $detailed_list_args[] = new DetailedListItem(get_the_title(), get_field("description"), get_permalink(), array("tag" => get_field("content_type"))); } $Detailed_List = new DetailedList($detailed_list_args); $Detailed_List->slider(); wp_reset_postdata(); } }