$item->optionsDir = get_post_meta($item->ID, '_ait-dir-item', true); $item->packageClass = getItemPackageClass($item->post_author); $item->rating = get_post_meta($item->ID, 'rating', true); } // add posts details foreach ($posts as $item) { $item->link = get_permalink($item->id); $image = wp_get_attachment_image_src(get_post_thumbnail_id($item->id)); if ($image !== false) { $item->thumbnailDir = getRealThumbnailUrl($image[0]); } else { $item->thumbnailDir = getRealThumbnailUrl($aitThemeOptions->directory->defaultItemImage); } $item->optionsDir = get_post_meta($item->id, '_ait-dir-item', true); //$item->excerptDir = aitGetPostExcerpt($item->excerpt,$item->content); $item->packageClass = getItemPackageClass($item->author->id); $item->rating = get_post_meta($item->id, 'rating', true); } // breadcrumbs $ancestorsIDs = array_reverse(get_ancestors(intval($term->term_id), 'ait-dir-item-category')); $ancestors = array(); foreach ($ancestorsIDs as $anc) { $cat = get_term($anc, 'ait-dir-item-category'); $cat->link = get_term_link($anc, 'ait-dir-item-category'); $ancestors[] = $cat; } $latteParams['ancestors'] = $ancestors; $latteParams['term'] = $term; $latteParams['subcategories'] = $subcategories; $latteParams['items'] = $items; $latteParams['posts'] = $posts;
if ($latteParams['type']) { // show all items on map if (isset($aitThemeOptions->search->searchShowMap)) { $radius = array(); if (isset($_GET['geo'])) { $radius[] = $_GET['geo-radius']; $radius[] = $_GET['geo-lat']; $radius[] = $_GET['geo-lng']; } $latteParams['items'] = getItems(intval($_GET['categories']), intval($_GET['locations']), $GLOBALS['wp_query']->query_vars['s'], $radius); } $posts = $wp_query->posts; foreach ($posts as $item) { $item->link = get_permalink($item->ID); $image = wp_get_attachment_image_src(get_post_thumbnail_id($item->ID)); if ($image !== false) { $item->thumbnailDir = getRealThumbnailUrl($image[0]); } else { $item->thumbnailDir = getRealThumbnailUrl($GLOBALS['aitThemeOptions']->directory->defaultItemImage); } $item->optionsDir = get_post_meta($item->ID, '_ait-dir-item', true); $item->excerptDir = aitGetPostExcerpt($item->post_excerpt, $item->post_content); $item->packageClass = getItemPackageClass($item->post_author); $item->rating = get_post_meta($item->ID, 'rating', true); } $latteParams['posts'] = $posts; } else { $latteParams['archive'] = new WpLatteArchiveEntity(); $latteParams['posts'] = WpLatte::createPostEntity($wp_query->posts); } WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
function getDirItemsDetails($items) { foreach ($items as $item) { $item->link = get_permalink($item->ID); $image = wp_get_attachment_image_src(get_post_thumbnail_id($item->ID), 'full'); if ($image !== false) { $item->thumbnailDir = $image[0]; } else { $item->thumbnailDir = $GLOBALS['aitThemeOptions']->directory->defaultItemImage; } $item->optionsDir = get_post_meta($item->ID, '_ait-dir-item', true); $item->excerptDir = aitGetPostExcerpt($item->post_excerpt, $item->post_content); $item->packageClass = getItemPackageClass($item->post_author); $item->rating = get_post_meta($item->ID, 'rating', true); } return $items; }