OSDN Git Service

WordPressテンプレート機能更新。
authornaoki hirata <naoki@magic3.org>
Tue, 4 Jul 2017 05:09:58 +0000 (14:09 +0900)
committernaoki hirata <naoki@magic3.org>
Tue, 4 Jul 2017 05:09:58 +0000 (14:09 +0900)
include/wp/contentApi.php
include/wp/wp-includes/class-wp-query.php

index 88cb7cf..2314c80 100644 (file)
@@ -490,6 +490,8 @@ class ContentApi extends BaseApi
         */
        function getPageLinkUrl($pageNo)
        {
+               global $wp_query;
+                               
                $baseUrl = '';
                $urlParams = '';
                
@@ -516,6 +518,11 @@ class ContentApi extends BaseApi
                        $baseUrl .= '?' . $urlParams . '&';
                }
                $baseUrl .= M3_REQUEST_PARAM_PAGE_NO . '=' . $pageNo;
+               
+               // 検索条件が設定されている場合は付加
+               $searchParam = $wp_query->get('s');
+               if (!empty($searchParam)) $baseUrl .= '&s=' . $searchParam;
+               
                $url = $this->getUrl($baseUrl);
                return $url;
        }
index ea56a46..47ee37d 100644 (file)
@@ -1666,14 +1666,14 @@ class WP_Query {
        public function get_posts() {
                global $gContentApi;
                global $gRequestManager;
-               
+                                       
                // ##### URLパラメータを解析 #####
                $this->query_vars = array();
                // ページ番号
                $pageNo = absint($gRequestManager->trimValueOf('page'));
                $this->query_vars['paged'] = $pageNo;
                if ($pageNo > 1) $this->is_paged = true;
-                       
+               
                // ##### DBからコンテンツを取得 #####
                // コンテンツタイプが設定されていない場合はダミーのWP_Postデータを作成
                $contentType = $gContentApi->getContentType();
@@ -1706,7 +1706,7 @@ class WP_Query {
                        $keywords = '';
                        
                        // 検索結果表示の場合はキーワードを取得
-                       $pageType = $gContentApi->getPageType();
+                       $pageType = $gContentApi->getPageType();                // ページタイプ取得
                        if ($pageType == 'search'){
                                $keywords = $gRequestManager->trimValueOf('s');
                                $this->query_vars['s'] = $keywords;