質問編集履歴

2

補足を追記

2019/06/01 17:52

投稿

TaikiNamioka
TaikiNamioka

スコア24

test CHANGED
File without changes
test CHANGED
@@ -115,3 +115,45 @@
115
115
  ?>
116
116
 
117
117
  ```
118
+
119
+
120
+
121
+ リロードした際に発火するコードはscriptタグで括られていなかったのでくくってheader.phpに記載しています。
122
+
123
+ ```
124
+
125
+ <?php $url = $_SERVER['REQUEST_URI'];
126
+
127
+ if(strstr($url,'page')==false):
128
+
129
+ ?>
130
+
131
+ <script>//こちらを追記
132
+
133
+ jQuery(document).ready(function( $ ) {
134
+
135
+ if (window.performance) {
136
+
137
+ if (performance.navigation.type === 1) {
138
+
139
+ var sesid = "pgsession";
140
+
141
+ $.removeCookie(sesid);
142
+
143
+ $.cookie(sesid, null);
144
+
145
+ $.cookie(sesid, "", {expires: -1});
146
+
147
+ $.cookie(sesid,"",{path:"/",expires:-1});
148
+
149
+ }
150
+
151
+ }
152
+
153
+ });
154
+
155
+ </script>//こちらを追記
156
+
157
+ <?php endif; ?>
158
+
159
+ ```

1

補足を追記

2019/06/01 17:52

投稿

TaikiNamioka
TaikiNamioka

スコア24

test CHANGED
File without changes
test CHANGED
@@ -79,3 +79,39 @@
79
79
  }
80
80
 
81
81
  ```
82
+
83
+
84
+
85
+ また記事の最初に出てきている以下のコードはfunctions.phpの最初に記載しています
86
+
87
+ ```
88
+
89
+ <?php
90
+
91
+ session_name("pgsession");
92
+
93
+ session_start();
94
+
95
+ add_filter('posts_orderby', 'edit_posts_orderby');
96
+
97
+ function edit_posts_orderby( $orderby ) {
98
+
99
+ $seed = $_SESSION['pgsession'];
100
+
101
+ if (empty($seed)) {
102
+
103
+ $seed = rand();
104
+
105
+ $_SESSION['pgsession'] = $seed;
106
+
107
+ }
108
+
109
+ $orderby = 'RAND(' . $seed . ')';
110
+
111
+ return $orderby;
112
+
113
+ }
114
+
115
+ ?>
116
+
117
+ ```