コード例 #1
0
ファイル: page-dir-home.php プロジェクト: kivivuori/jotain
$latteParams['post'] = WpLatte::createPostEntity($GLOBALS['wp_query']->post, array('meta' => $GLOBALS['pageOptions']));
// get top categories
$subcategories = array();
if (isset($aitThemeOptions->directory->showTopCategories)) {
    //$catNumber = ($aitThemeOptions->directory->topCategoriesNumber) ? $aitThemeOptions->directory->topCategoriesNumber : 9;
    $subcategories = get_terms('ait-dir-item-category', array('number' => 999999999, 'hide_empty' => false, 'parent' => 0));
    // add category links
    foreach ($subcategories as $category) {
        $category->link = get_term_link(intval($category->term_id), 'ait-dir-item-category');
        $category->icon = getRealThumbnailUrl(getCategoryMeta("icon", intval($category->term_id)));
        $category->excerpt = getCategoryMeta("excerpt", intval($category->term_id));
    }
}
$latteParams['subcategories'] = $subcategories;
// get top locations
$sublocations = array();
if (isset($aitThemeOptions->directory->showTopLocations)) {
    $sublocations = get_terms('ait-dir-item-location', array('number' => 999999999, 'hide_empty' => false, 'parent' => 0));
    // add category links
    foreach ($sublocations as $location) {
        $location->link = get_term_link(intval($location->term_id), 'ait-dir-item-location');
        $location->icon = getRealThumbnailUrl(getLocationMeta("icon", intval($location->term_id)));
        $location->excerpt = getlocationMeta("excerpt", intval($location->term_id));
    }
}
$latteParams['sublocations'] = $sublocations;
$latteParams['sidebarType'] = 'home';
/**
 * Fire!
 */
WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
コード例 #2
0
<?php

$term = $GLOBALS['wp_query']->queried_object;
$subcategories = get_terms('ait-dir-item-location', array('parent' => intval($term->term_id), 'hide_empty' => false));
$posts = WpLatte::createPostEntity($GLOBALS['wp_query']->posts);
$items = get_posts(array('numberposts' => -1, 'post_type' => 'ait-dir-item', 'tax_query' => array(array('taxonomy' => 'ait-dir-item-location', 'field' => 'id', 'terms' => intval($term->term_id), 'include_children' => true))));
$term->link = get_term_link($term);
$term->icon = getRealThumbnailUrl(getLocationMeta("icon", intval($term->term_id)));
// add subcategory links
foreach ($subcategories as $category) {
    $category->link = get_term_link(intval($category->term_id), 'ait-dir-item-location');
    $category->icon = getRealThumbnailUrl(getLocationMeta("icon", intval($category->term_id)));
    $category->excerpt = getLocationMeta("excerpt", intval($category->term_id));
}
// add items details
foreach ($items 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);
    }
    $terms = wp_get_post_terms($item->ID, 'ait-dir-item-category');
    $termMarker = $GLOBALS['aitThemeOptions']->directoryMap->defaultMapMarkerImage;
    if (isset($terms[0])) {
        $termMarker = getCategoryMeta("marker", intval($terms[0]->term_id));
    }
    $item->marker = $termMarker;
    $item->optionsDir = get_post_meta($item->ID, '_ait-dir-item', true);
    $item->packageClass = getItemPackageClass($item->post_author);