質問編集履歴
2
補足を追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -56,4 +56,25 @@
|
|
56
56
|
return $orderby;
|
57
57
|
}
|
58
58
|
?>
|
59
|
+
```
|
60
|
+
|
61
|
+
リロードした際に発火するコードはscriptタグで括られていなかったのでくくってheader.phpに記載しています。
|
62
|
+
```
|
63
|
+
<?php $url = $_SERVER['REQUEST_URI'];
|
64
|
+
if(strstr($url,'page')==false):
|
65
|
+
?>
|
66
|
+
<script>//こちらを追記
|
67
|
+
jQuery(document).ready(function( $ ) {
|
68
|
+
if (window.performance) {
|
69
|
+
if (performance.navigation.type === 1) {
|
70
|
+
var sesid = "pgsession";
|
71
|
+
$.removeCookie(sesid);
|
72
|
+
$.cookie(sesid, null);
|
73
|
+
$.cookie(sesid, "", {expires: -1});
|
74
|
+
$.cookie(sesid,"",{path:"/",expires:-1});
|
75
|
+
}
|
76
|
+
}
|
77
|
+
});
|
78
|
+
</script>//こちらを追記
|
79
|
+
<?php endif; ?>
|
59
80
|
```
|
1
補足を追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -38,4 +38,22 @@
|
|
38
38
|
echo "</ul>\n";
|
39
39
|
}
|
40
40
|
}
|
41
|
+
```
|
42
|
+
|
43
|
+
また記事の最初に出てきている以下のコードはfunctions.phpの最初に記載しています
|
44
|
+
```
|
45
|
+
<?php
|
46
|
+
session_name("pgsession");
|
47
|
+
session_start();
|
48
|
+
add_filter('posts_orderby', 'edit_posts_orderby');
|
49
|
+
function edit_posts_orderby( $orderby ) {
|
50
|
+
$seed = $_SESSION['pgsession'];
|
51
|
+
if (empty($seed)) {
|
52
|
+
$seed = rand();
|
53
|
+
$_SESSION['pgsession'] = $seed;
|
54
|
+
}
|
55
|
+
$orderby = 'RAND(' . $seed . ')';
|
56
|
+
return $orderby;
|
57
|
+
}
|
58
|
+
?>
|
41
59
|
```
|