Exemple #1
0
 /**
  * Alias for WpLatteSiteEntity::createCusomPostEntity()
  *
  * @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)
 {
     return WpLatteSiteEntity::createCustomPostEntity($what, $category, $limit, $order, $suppress_filters);
 }
Exemple #2
0
 /**
  * Singleton "constructor"
  * @return self
  */
 public static function getInstance()
 {
     if (self::$instance === NULL) {
         self::$instance = new self();
     }
     global $wp_query;
     self::$instance->isHome = $wp_query->is_home;
     self::$instance->isSingle = $wp_query->is_single;
     self::$instance->isPage = $wp_query->is_page;
     self::$instance->isSearch = $wp_query->is_search;
     self::$instance->isArchive = $wp_query->is_archive && !$wp_query->is_category && !$wp_query->is_tag && !$wp_query->is_author;
     self::$instance->isCategory = $wp_query->is_category;
     self::$instance->isAuthor = $wp_query->is_author;
     self::$instance->isTag = $wp_query->is_tag;
     self::$instance->is404 = $wp_query->is_404;
     self::$instance->isBlog = $wp_query->is_home and $wp_query->is_posts_page;
     self::$instance->isFrontPage = is_front_page();
     self::$instance->isHomepage = is_front_page();
     // alias
     self::$instance->isPaged = is_paged();
     // alias
     $ua = $_SERVER['HTTP_USER_AGENT'];
     self::$instance->isIpad = strpos($ua, 'iPad') !== false;
     self::$instance->isIphone = strpos($ua, 'iPhone') !== false || strpos($ua, 'iPod') !== false;
     self::$instance->isMobile = stripos($ua, 'safari') !== false && stripos($ua, 'mobile') !== false || stripos($ua, 'android') !== false && stripos($ua, 'mobile') !== false;
     return self::$instance;
 }