質問編集履歴
3
archive.phpのソースを削除しエラーログを記載いたしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -70,63 +70,31 @@
|
|
70
70
|
|
71
71
|
|
72
72
|
|
73
|
-
|
73
|
+
エラーログを確認したところ以下のエラーが出ていました。
|
74
74
|
|
75
|
-
|
75
|
+
PHP Warning: Missing argument 1 for query_posts(), called in /opt2/web/example.jp/htdocs/news/wp-content/themes/example/archive.php on line 24 and defined in /opt2/web/example.jp/htdocs/news/wp-includes/query.php on line 96
|
76
76
|
|
77
|
-
<div class="rightCont">
|
78
77
|
|
79
|
-
<div id="marchive" class="clearfix">
|
80
78
|
|
81
|
-
|
79
|
+
それぞれのファイルの該当箇所が以下になっていましたので、こちらのquery_posts();の書き方に問題があるのでしょうか。
|
82
80
|
|
83
|
-
<?php if ( is_day() ) : ?>
|
84
|
-
|
85
|
-
<?php printf( __( '日別: %s', 'twentyeleven' ), '<span>' . get_the_date() . '</span>' ); ?>
|
86
|
-
|
87
|
-
<?php elseif ( is_month() ) : ?>
|
88
|
-
|
89
|
-
<?php printf( __( '月別: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
|
90
|
-
|
91
|
-
<?php elseif ( is_year() ) : ?>
|
92
|
-
|
93
|
-
<?php printf( __( '年別: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
|
94
|
-
|
95
|
-
<?php else : ?>
|
96
|
-
|
97
|
-
<?php _e( 'Blog Archives', 'twentyeleven' ); ?>
|
98
|
-
|
99
|
-
<?php endif; ?>
|
100
|
-
|
101
|
-
|
81
|
+
archive.php
|
102
|
-
|
103
|
-
</div>
|
104
82
|
|
105
83
|
<?php query_posts(); ?>
|
106
84
|
|
107
|
-
<?php while ( have_posts() ) : the_post(); ?>
|
108
85
|
|
109
|
-
<?php get_template_part( 'content', get_post_format() ); ?>
|
110
86
|
|
111
|
-
|
87
|
+
query.php
|
112
88
|
|
113
|
-
|
89
|
+
function query_posts($query) {
|
114
90
|
|
115
|
-
|
91
|
+
$GLOBALS['wp_query'] = new WP_Query();
|
116
92
|
|
117
|
-
|
93
|
+
return $GLOBALS['wp_query']->query($query);
|
118
94
|
|
119
|
-
|
95
|
+
}
|
120
96
|
|
121
|
-
<li id="sNav02"><?php next_posts_link('nextpage »'); ?></li>
|
122
97
|
|
123
|
-
</ul>
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
</div>
|
128
|
-
|
129
|
-
<?php get_footer(); ?>
|
130
98
|
|
131
99
|
|
132
100
|
|
2
archive.phpのソースを追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -70,6 +70,66 @@
|
|
70
70
|
|
71
71
|
|
72
72
|
|
73
|
+
archive.phpのソースは以下のようになっています。
|
74
|
+
|
75
|
+
<?php get_header(); ?>
|
76
|
+
|
77
|
+
<div class="rightCont">
|
78
|
+
|
79
|
+
<div id="marchive" class="clearfix">
|
80
|
+
|
81
|
+
<h3>
|
82
|
+
|
83
|
+
<?php if ( is_day() ) : ?>
|
84
|
+
|
85
|
+
<?php printf( __( '日別: %s', 'twentyeleven' ), '<span>' . get_the_date() . '</span>' ); ?>
|
86
|
+
|
87
|
+
<?php elseif ( is_month() ) : ?>
|
88
|
+
|
89
|
+
<?php printf( __( '月別: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
|
90
|
+
|
91
|
+
<?php elseif ( is_year() ) : ?>
|
92
|
+
|
93
|
+
<?php printf( __( '年別: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
|
94
|
+
|
95
|
+
<?php else : ?>
|
96
|
+
|
97
|
+
<?php _e( 'Blog Archives', 'twentyeleven' ); ?>
|
98
|
+
|
99
|
+
<?php endif; ?>
|
100
|
+
|
101
|
+
</h3>
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<?php query_posts(); ?>
|
106
|
+
|
107
|
+
<?php while ( have_posts() ) : the_post(); ?>
|
108
|
+
|
109
|
+
<?php get_template_part( 'content', get_post_format() ); ?>
|
110
|
+
|
111
|
+
<?php endwhile; ?>
|
112
|
+
|
113
|
+
<div id="sNav">
|
114
|
+
|
115
|
+
<ul>
|
116
|
+
|
117
|
+
<li id="sNav01">
|
118
|
+
|
119
|
+
<?php previous_posts_link('« previouspage');?></li>
|
120
|
+
|
121
|
+
<li id="sNav02"><?php next_posts_link('nextpage »'); ?></li>
|
122
|
+
|
123
|
+
</ul>
|
124
|
+
|
125
|
+
</div>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<?php get_footer(); ?>
|
130
|
+
|
131
|
+
|
132
|
+
|
73
133
|
### 試したこと
|
74
134
|
|
75
135
|
|
1
ドメイン名の例示を間違っていたので修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,13 +42,13 @@
|
|
42
42
|
|
43
43
|
管理画面のパーマリンク
|
44
44
|
|
45
|
-
https://a
|
45
|
+
https://example.jp/news/%year%/%monthnum%/%day%/%post_id%.html
|
46
46
|
|
47
47
|
|
48
48
|
|
49
49
|
生成される各記事のURL
|
50
50
|
|
51
|
-
https://a
|
51
|
+
https://example.jp/news/2018/09/10/276.html
|
52
52
|
|
53
53
|
|
54
54
|
|
@@ -60,11 +60,11 @@
|
|
60
60
|
|
61
61
|
<ul>
|
62
62
|
|
63
|
-
<li><a href='https://a
|
63
|
+
<li><a href='https://example.jp/news/2018'>2018</a></li>
|
64
64
|
|
65
|
-
<li><a href='https://a
|
65
|
+
<li><a href='https://example.jp/news/2017'>2017</a></li>
|
66
66
|
|
67
|
-
<li><a href='https://a
|
67
|
+
<li><a href='https://example.jp/news/2016'>2016</a></li>
|
68
68
|
|
69
69
|
</ul>
|
70
70
|
|