OSDN Git Service

WordPressテンプレート機能更新。
authornaoki hirata <naoki@magic3.org>
Fri, 18 Aug 2017 02:49:54 +0000 (11:49 +0900)
committernaoki hirata <naoki@magic3.org>
Fri, 18 Aug 2017 02:49:54 +0000 (11:49 +0900)
include/wp/contentApi.php
include/wp/wp-includes/class-wp-query.php

index 8957b2c..b1bfb90 100644 (file)
@@ -830,5 +830,18 @@ class ContentApi extends BaseApi
        {
                return $this->isTemplatePart;
        }
+       /**
+        * URLがホーム(コンテンツタイプが設定されているページ内でのトップページ)を指しているかどうか取得
+        *
+        * @return bool                 true=ホーム、false=ホーム以外
+        */
+       function isHomeUrl()
+       {
+               if (!empty($this->contentType) && empty($this->pageType)){
+                       return true;
+               } else {
+                       return false;
+               }
+       }
 }
 ?>
index f622479..11a10a5 100644 (file)
@@ -2550,7 +2550,11 @@ class WP_Query {
         */
        public function is_home() {
 //             return (bool) $this->is_home;
-               return $this->is_front_page();
+//             return $this->is_front_page();
+
+               global $gContentApi;
+               $isHome = $gContentApi->isHomeUrl();
+               return $isHome;
        }
 
        /**