質問するログイン新規登録

質問編集履歴

3

コード追記

2020/02/15 11:06

投稿

JAMJP
JAMJP

スコア13

title CHANGED
File without changes
body CHANGED
@@ -60,4 +60,32 @@
60
60
  ```
61
61
 
62
62
  ###追記
63
- archive-myoptions.phpで出力される一覧アーカイブページでは無事に出力されています。
63
+ archive-myoptions.phpで出力される一覧アーカイブページでは無事に出力されています。
64
+
65
+
66
+ ###追記
67
+ ```
68
+ <?php
69
+ $args = array( 'post_type' => 'myoptions' );
70
+ $myposts = get_posts( $args );
71
+
72
+ foreach ( $myposts as $post ) : setup_postdata( $post );
73
+ ?>
74
+ <?php if(have_rows('options_list')) : ?>
75
+ <table class="table02">
76
+ <tbody>
77
+ <?php while(have_rows('options_list')): the_row(); ?>
78
+ <tr>
79
+ <th>
80
+ <?php the_sub_field('options_list_name'); ?>
81
+ </th>
82
+ <td>
83
+ <?php the_sub_field('options_list_price'); ?>
84
+ </td>
85
+ </tr>
86
+ <?php endwhile; ?>
87
+ </tbody>
88
+ </table>
89
+ <?php endif; ?>
90
+ <?php endforeach;?>
91
+ ```

2

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

2020/02/15 11:06

投稿

JAMJP
JAMJP

スコア13

title CHANGED
File without changes
body CHANGED
@@ -57,4 +57,7 @@
57
57
 
58
58
  }
59
59
  add_action( 'init', 'create_post_type' );
60
- ```
60
+ ```
61
+
62
+ ###追記
63
+ archive-myoptions.phpで出力される一覧アーカイブページでは無事に出力されています。

1

functions.phpの内容を追記

2020/02/15 09:36

投稿

JAMJP
JAMJP

スコア13

title CHANGED
File without changes
body CHANGED
@@ -32,4 +32,29 @@
32
32
 
33
33
  ### 現在のACF側の設定スクショ
34
34
 
35
- ![イメージ説明](8e7221ced35c01f5629d0f80b35a044e.jpeg)
35
+ ![イメージ説明](8e7221ced35c01f5629d0f80b35a044e.jpeg)
36
+
37
+
38
+ ### functions.phpに管理画面左メニュー
39
+ ```
40
+ function create_post_type() {
41
+ //料金システムページオプション
42
+ $Supportcustom = [// 投稿画面で表示される項目の設定
43
+ 'title', // 記事タイトル
44
+ ];
45
+ register_post_type( 'myoptions', // URLになる部分
46
+ array(
47
+ 'label' => 'オプションリスト', // 管理画面の左メニューに表示されるテキスト
48
+ 'labels' => array(
49
+ 'all_items' => 'オプション一覧'// 管理画面の左メニューの下層に表示されるテキスト
50
+ ),
51
+ 'public' => true,
52
+ 'has_archive' => true,
53
+ 'menu_position' => 9,
54
+ 'supports' => $Supportscustom
55
+ )
56
+ );
57
+
58
+ }
59
+ add_action( 'init', 'create_post_type' );
60
+ ```