Beispiel #1
0
 /**
  * Creates Entities from Custom Types (static Alias)
  * @param string $what Name of custom type without "ait-" prefix
  * @param string $category Selecting custom type by specific category
  * @param int $limit Limit of returned items
  * @return array|WpLattePostEntity
  */
 public static function createCustomPostEntity($what, $category = 0, $limit = null, $order = 'menu_order', $suppress_filters = false)
 {
     if (empty($limit) or $limit === false) {
         $limit = -1;
     }
     // default, no value entered in admin or missing parameter
     $tax = array();
     if ($category !== 0 && $category !== "0" && $category !== null) {
         $tax = array(array('taxonomy' => 'ait-' . $what . '-category', 'field' => 'slug', 'terms' => $category));
     }
     $options = WpLatteFunctions::dash2camel($what) . 'Options';
     // convention over configuration
     return WpLatte::createPostEntity(new WP_Query(array('tax_query' => $tax, 'post_type' => 'ait-' . $what, 'post_status' => 'publish', 'orderby' => $order, 'order' => 'ASC', 'posts_per_page' => $limit, 'suppress_filters' => $suppress_filters)), array('meta' => @$GLOBALS[$options], 'isCustomType' => true));
 }
Beispiel #2
0
<?php

$latteParams['bodyClasses'] .= ' with-sidebar';
$latteParams['bodyId'] = 'normal-page';
$latteParams['archive'] = new WpLatteArchiveEntity();
$latteParams['posts'] = WpLatte::createPostEntity($GLOBALS['wp_query']->posts);
$latteParams['customTypeName'] = defined('EDITABLE_CT_NAME') ? EDITABLE_CT_NAME : '';
$latteParams['customTypeShow'] = defined('SHOW_EDITABLE_CT_IN_MENU') ? SHOW_EDITABLE_CT_IN_MENU : '';
$latteParams['roomTypeName'] = defined('ROOM_CT_NAME') ? ROOM_CT_NAME : '';
/* GET CATEGORIES FOR GROUPING IN SLIDER */
$sliderOptions = aitGetOptions($latteParams['post'], 'page_slider');
if ($sliderOptions->sliderFormCat == "0") {
    $categories = array();
    $term = get_categories(array('taxonomy' => 'ait-item-category', 'hide_empty' => 0, 'number' => 0));
    foreach ($term as $item) {
        if ($item->term_id == 1) {
        } else {
            array_push($categories, $item->name);
        }
    }
}
$latteParams['itemSliderCategories'] = $categories;
/* GET CATEGORIES FOR GROUPING IN SLIDER */
WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
Beispiel #3
0
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();
Beispiel #4
0
<?php

/*
 * AIT WordPress Theme
 *
 * Copyright (c) 2013, Affinity Information Technology, s.r.o. (http://ait-themes.com)
 */
global $latteParams;
$latteParams['post'] = WpLatte::createPostEntity(get_post(woocommerce_get_page_id('shop')), array('meta' => $GLOBALS['pageOptions']));
WpLatte::createTemplate(__FILE__, $latteParams)->render();
<?php

$latteParams['bodyClasses'] .= ' with-sidebar';
$latteParams['bodyId'] = 'normal-page';
$latteParams['post'] = WpLatte::createPostEntity($wp_query->post, array('meta' => $pageOptions));
$latteParams['post']->classes = implode(' ', get_post_class());
/* Parse video provider */
global $wpdb;
$sql = "SELECT meta_value FROM " . $wpdb->prefix . "postmeta WHERE post_id=" . $latteParams['post']->id . " AND meta_key LIKE '%_ait%'";
$itemMeta = $wpdb->get_results($sql);
$itemMetaValue = unserialize($itemMeta[0]->meta_value);
if ($itemMetaValue['itemType'] == NULL) {
    $itemMetaValue['itemType'] = 'image';
}
$itemMetaValue['videoAutoplay'] = 0;
/* Parse video provider && video id*/
if (strpos($itemMetaValue['videoLink'], 'vimeo') != false) {
    $itemMetaValue['videoProvider'] = 'vimeo';
    $itemMetaValue['videoID'] = str_replace('http://vimeo.com/', '', $itemMetaValue['videoLink']);
} else {
    $itemMetaValue['videoProvider'] = 'youtube';
    $temp = str_replace('http://www.youtube.com/watch?v=', '', $itemMetaValue['videoLink']);
    $itemMetaValue['videoID'] = substr($temp, 0, strpos($temp, '&'));
}
$latteParams['gridGalleryOptions'] = $itemMetaValue;
/* Parse video provider */
WpLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
Beispiel #6
0
<?php

/**
 * AIT WordPress Theme
 *
 * Copyright (c) 2012, Affinity Information Technology, s.r.o. (http://ait-themes.com)
 */
/**
 * Template Name: Fullwidth Template
 * Description: Page without sidebar
 */
$latteParams['post'] = WpLatte::createPostEntity($GLOBALS['wp_query']->post, array('meta' => $GLOBALS['pageOptions']));
$latteParams['fullwidth'] = true;
/**
 * Fire!
 */
WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
Beispiel #7
0
<?php

/**
 * AIT WordPress Theme
 *
 * Copyright (c) 2012, Affinity Information Technology, s.r.o. (http://ait-themes.com)
 */
$latteParams['post'] = WpLatte::createPostEntity($post, array('meta' => $pageOptions));
$latteParams['post']->classes = implode(' ', get_post_class());
WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
Beispiel #8
0
     // echo '</script>';
     echo '<style>';
     include_once dirname(__FILE__) . '/easy-admin.css';
     echo '</style>';
     $screen = get_current_screen();
     if ($screen->base == 'profile') {
         echo '<script>';
         include_once dirname(__FILE__) . '/easy-admin-profile.js';
         echo '</script>';
     }
 }
 /**
  * Prepare variables for templates
  */
 WpLatte::$cacheDir = realpath(AIT_CACHE_DIR);
 WpLatte::$templatesDir = realpath(AIT_TEMPLATES_DIR);
 $GLOBALS['latteParams'] = array('themeUrl' => THEME_URL, 'homeUrl' => home_url('/'), 'themeOptions' => $GLOBALS['aitThemeOptions']);
 /**
  * Easy admin header branding
  */
 add_action('in_admin_header', 'aitEasyAdminBrandingHeader', 1);
 function aitEasyAdminBrandingHeader()
 {
     echo '<div id="ait-easy-admin-branding-header" class="ait-easy-admin-branding-header">';
     WPLatte::createTemplate(THEME_DIR . '/Templates/snippets/branding-header.php', $GLOBALS['latteParams'], true)->render();
     echo '</div>';
 }
 /**
  * Easy admin header
  */
 // add_action('in_admin_header', 'aitEasyAdminHeader',2);
<?php

$term = $GLOBALS['wp_query']->queried_object;
$subcategories = get_terms('ait-dir-item-category', 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-category', 'field' => 'id', 'terms' => intval($term->term_id), 'include_children' => true))));
$term->link = get_term_link($term);
$term->icon = getRealThumbnailUrl(getCategoryMeta("icon", intval($term->term_id)));
$term->marker = getCategoryMeta("marker", intval($term->term_id));
// add subcategory 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));
}
// 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);
    }
    $item->marker = $term->marker;
    $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) {
Beispiel #10
0
<?php

$wpLoad = '../../../wp-load.php';
require_once realpath($wpLoad);
require_once AIT_FRAMEWORK_DIR . '/Libs/PiecemakerSliderXmlGenerator.php';
if (isset($_GET['t'])) {
    $t = strip_tags($_GET['t']);
    $slides = WpLatte::createCustomPostEntity('slider-creator', $t);
    $piecemaker = new PiecemakerSliderXmlGenerator($slides, $GLOBALS['aitThemeOptions']->header);
    header("Content-type: application/xml");
    echo str_replace("\n", '', $piecemaker->render());
}
Beispiel #11
0
if ($latteParams['type']) {
    $latteParams['isDirSearch'] = true;
    // 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);
    }
} else {
    $posts = WpLatte::createPostEntity($wp_query->posts);
}
$latteParams['posts'] = $posts;
WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
Beispiel #12
0
<?php

$latteParams['bodyClasses'] .= ' with-sidebar';
$latteParams['bodyId'] = 'normal-page';
$latteParams['author'] = new WpLattePostAuthorEntity($GLOBALS['wp_query']->queried_object);
$latteParams['posts'] = WpLatte::createPostEntity($GLOBALS['wp_query']->posts, array('author' => $latteParams['author']));
$latteParams['customTypeName'] = defined('EDITABLE_CT_NAME') ? EDITABLE_CT_NAME : '';
$latteParams['customTypeShow'] = defined('SHOW_EDITABLE_CT_IN_MENU') ? SHOW_EDITABLE_CT_IN_MENU : '';
$latteParams['roomTypeName'] = defined('ROOM_CT_NAME') ? ROOM_CT_NAME : '';
/* GET CATEGORIES FOR GROUPING IN SLIDER */
$sliderOptions = aitGetOptions($latteParams['post'], 'page_slider');
if ($sliderOptions->sliderFormCat == "0") {
    $categories = array();
    $term = get_categories(array('taxonomy' => 'ait-item-category', 'hide_empty' => 0, 'number' => 0));
    foreach ($term as $item) {
        if ($item->term_id == 1) {
        } else {
            array_push($categories, $item->name);
        }
    }
}
$latteParams['itemSliderCategories'] = $categories;
/* GET CATEGORIES FOR GROUPING IN SLIDER */
WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
Beispiel #13
0
<?php

/**
 * AIT WordPress Theme
 *
 * Copyright (c) 2012, Affinity Information Technology, s.r.o. (http://ait-themes.com)
 */
$latteParams['author'] = new WpLattePostAuthorEntity($wp_query->queried_object);
$latteParams['posts'] = WpLatte::createPostEntity($wp_query->posts, array('author' => $latteParams['author']));
WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();