質問編集履歴

2

テストコードの追加

2019/03/14 09:25

投稿

sk10132019
sk10132019

スコア10

test CHANGED
File without changes
test CHANGED
@@ -40,6 +40,76 @@
40
40
 
41
41
  ](https://private.hibou-web.com/archives/6226)
42
42
 
43
+
44
+
45
+ ### コード
46
+
47
+ 上記のサイトを参考に試したコードは以下、
48
+
49
+ フィールドグループに登録されている「投稿オブジェクト」の値が取得できず。
50
+
51
+ ```PHP
52
+
53
+ function get_acfe_field($field = null , $acf_id = null){
54
+
55
+ $acf_fields = get_post_custom( $acf_id );
56
+
57
+ if( is_array($acf_fields) ){
58
+
59
+ foreach( $acf_fields as $key=>$item ){
60
+
61
+ if(strpos($key,'field') !== false){
62
+
63
+ $item_value = unserialize($item[0]);
64
+
65
+ if( $item_value['name'] == $field ){
66
+
67
+ $acfe_fields[ $item_value['name'] ] = $item_value;
68
+
69
+ }
70
+
71
+ }
72
+
73
+ }
74
+
75
+ }
76
+
77
+ return $acfe_fields[$field];
78
+
79
+ }
80
+
81
+ var_dump(get_acfe_field('target_field','1234'));
82
+
83
+
84
+
85
+ ```
86
+
87
+
88
+
89
+ ```php
90
+
91
+ add_action('restrict_manage_posts', 'add_subtitle_filter');
92
+
93
+ function add_subtitle_filter(){
94
+
95
+ global $post_type;
96
+
97
+ if ( $post_type == 'post' ) {
98
+
99
+ foreach (get_field('target_field') as $value) {
100
+
101
+ var_dump($value);
102
+
103
+ }
104
+
105
+ }
106
+
107
+ };
108
+
109
+ ```
110
+
111
+
112
+
43
113
  ### 補足情報(FW/ツールのバージョンなど)
44
114
 
45
115
 

1

リンクを設定

2019/03/14 09:25

投稿

sk10132019
sk10132019

スコア10

test CHANGED
File without changes
test CHANGED
@@ -28,13 +28,17 @@
28
28
 
29
29
  以下のサイトを参考に実装してみたが、動作せず。
30
30
 
31
- https://nxpg.net/blog/?p=7467
31
+ [https://nxpg.net/blog/?p=7467
32
32
 
33
- https://www.healing-solutions.jp/tech/4298/
33
+ ](https://nxpg.net/blog/?p=7467)
34
34
 
35
- https://private.hibou-web.com/archives/6226
35
+ [https://www.healing-solutions.jp/tech/4298/
36
36
 
37
+ ](https://www.healing-solutions.jp/tech/4298/)
37
38
 
39
+ [https://private.hibou-web.com/archives/6226
40
+
41
+ ](https://private.hibou-web.com/archives/6226)
38
42
 
39
43
  ### 補足情報(FW/ツールのバージョンなど)
40
44