質問編集履歴

3

コード追記

2020/02/15 11:06

投稿

JAMJP
JAMJP

スコア13

test CHANGED
File without changes
test CHANGED
@@ -123,3 +123,59 @@
123
123
  ###追記
124
124
 
125
125
  archive-myoptions.phpで出力される一覧アーカイブページでは無事に出力されています。
126
+
127
+
128
+
129
+
130
+
131
+ ###追記
132
+
133
+ ```
134
+
135
+ <?php
136
+
137
+ $args = array( 'post_type' => 'myoptions' );
138
+
139
+ $myposts = get_posts( $args );
140
+
141
+
142
+
143
+ foreach ( $myposts as $post ) : setup_postdata( $post );
144
+
145
+ ?>
146
+
147
+ <?php if(have_rows('options_list')) : ?>
148
+
149
+ <table class="table02">
150
+
151
+ <tbody>
152
+
153
+ <?php while(have_rows('options_list')): the_row(); ?>
154
+
155
+ <tr>
156
+
157
+ <th>
158
+
159
+ <?php the_sub_field('options_list_name'); ?>
160
+
161
+ </th>
162
+
163
+ <td>
164
+
165
+ <?php the_sub_field('options_list_price'); ?>
166
+
167
+ </td>
168
+
169
+ </tr>
170
+
171
+ <?php endwhile; ?>
172
+
173
+ </tbody>
174
+
175
+ </table>
176
+
177
+ <?php endif; ?>
178
+
179
+ <?php endforeach;?>
180
+
181
+ ```

2

archive-myoptions.phpにて一覧出力はできております。

2020/02/15 11:06

投稿

JAMJP
JAMJP

スコア13

test CHANGED
File without changes
test CHANGED
@@ -117,3 +117,9 @@
117
117
  add_action( 'init', 'create_post_type' );
118
118
 
119
119
  ```
120
+
121
+
122
+
123
+ ###追記
124
+
125
+ archive-myoptions.phpで出力される一覧アーカイブページでは無事に出力されています。

1

functions.phpの内容を追記

2020/02/15 09:36

投稿

JAMJP
JAMJP

スコア13

test CHANGED
File without changes
test CHANGED
@@ -67,3 +67,53 @@
67
67
 
68
68
 
69
69
  ![イメージ説明](8e7221ced35c01f5629d0f80b35a044e.jpeg)
70
+
71
+
72
+
73
+
74
+
75
+ ### functions.phpに管理画面左メニュー
76
+
77
+ ```
78
+
79
+ function create_post_type() {
80
+
81
+ //料金システムページオプション
82
+
83
+ $Supportcustom = [// 投稿画面で表示される項目の設定
84
+
85
+ 'title', // 記事タイトル
86
+
87
+ ];
88
+
89
+ register_post_type( 'myoptions', // URLになる部分
90
+
91
+ array(
92
+
93
+ 'label' => 'オプションリスト', // 管理画面の左メニューに表示されるテキスト
94
+
95
+ 'labels' => array(
96
+
97
+ 'all_items' => 'オプション一覧'// 管理画面の左メニューの下層に表示されるテキスト
98
+
99
+ ),
100
+
101
+ 'public' => true,
102
+
103
+ 'has_archive' => true,
104
+
105
+ 'menu_position' => 9,
106
+
107
+ 'supports' => $Supportscustom
108
+
109
+ )
110
+
111
+ );
112
+
113
+
114
+
115
+ }
116
+
117
+ add_action( 'init', 'create_post_type' );
118
+
119
+ ```