質問編集履歴

2

$titlehtml = get_field('titlehtml', $term_idsp);を追加しました

2020/11/13 08:57

投稿

raise
raise

スコア9

test CHANGED
File without changes
test CHANGED
@@ -78,9 +78,11 @@
78
78
 
79
79
  $term_id = $the_term->term_id;
80
80
 
81
- $term_idsp = $taxonomy."_".$term_id;
81
+ $term_idsp = $taxonomy."_".$term_id;
82
82
 
83
83
  $term_idsp = get_field( 'titlehtml', 'term_idsp'.$term_ID);
84
+
85
+ $titlehtml = get_field('titlehtml', $term_idsp);
84
86
 
85
87
  } ?>
86
88
 

1

マークダウンこちらで合っていますか

2020/11/13 08:57

投稿

raise
raise

スコア9

test CHANGED
File without changes
test CHANGED
@@ -16,7 +16,37 @@
16
16
 
17
17
  <title>
18
18
 
19
- <?$taxonomy = 'area_cat'; $term_slug = get_query_var('term'); $the_term = get_term_by('slug', $term_slug, $taxonomy); $term_id = $the_term->term_id; $term_idsp = $taxonomy."_".$term_id; if(get_field('titlehtml', $term_idsp)){echo (get_field('titlehtml', $term_idsp));} ?>
19
+ <?$taxonomy = 'area_cat';
20
+
21
+ $term_slug = get_query_var('term');
22
+
23
+
24
+
25
+ $the_term = get_term_by('slug', $term_slug, $taxonomy);
26
+
27
+ $term_id = $the_term->term_id;
28
+
29
+
30
+
31
+ //タームのカスタムフィールドを取得するためのIDは「カスタム分類(タクソノミー)名_タームID」
32
+
33
+ $term_idsp = $taxonomy."_".$term_id;
34
+
35
+
36
+
37
+ //タームではなく、カテゴリの場合は「category_カテゴリID」にする
38
+
39
+ //$cat_id = $category->cat_ID;
40
+
41
+ //$term_idsp = 'category_'.$cat_id;
42
+
43
+
44
+
45
+ if(get_field('titlehtml', $term_idsp)){
46
+
47
+ echo get_field('titlehtml', $term_idsp);
48
+
49
+ } ?>
20
50
 
21
51
  </title>
22
52