回答編集履歴

4

修正

2018/11/15 21:18

投稿

KazuhiroHatano
KazuhiroHatano

スコア7804

test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  $fluits1 = call_user_func('get_'.$this-> target_object,$post->ID, $this->param[0]);
20
20
 
21
- $fluits2 = call_user_func('get_the_'.$this-> target_object,$post->ID, $this->param[1]);
21
+ $fluits2 = call_user_func('get_'.$this-> target_object,$post->ID, $this->param[1]);
22
22
 
23
23
  ....
24
24
 

3

修正

2018/11/15 21:18

投稿

KazuhiroHatano
KazuhiroHatano

スコア7804

test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  ....
18
18
 
19
- $fluits1 = call_user_func('get_the_'.$this-> target_object,$post->ID, $this->param[0]);
19
+ $fluits1 = call_user_func('get_'.$this-> target_object,$post->ID, $this->param[0]);
20
20
 
21
21
  $fluits2 = call_user_func('get_the_'.$this-> target_object,$post->ID, $this->param[1]);
22
22
 
@@ -28,13 +28,13 @@
28
28
 
29
29
 
30
30
 
31
- $situmon1=new Situmon('posts',['形','色']);
31
+ $situmon1=new Situmon('post_meta',['形','色']);
32
32
 
33
33
  $situmon1->exec();
34
34
 
35
35
 
36
36
 
37
- $situmon2=new Situmon('terms',['味','趣']);
37
+ $situmon2=new Situmon('the_terms',['味','趣']);
38
38
 
39
39
  $situmon2->exec();
40
40
 

2

修正

2018/11/15 21:18

投稿

KazuhiroHatano
KazuhiroHatano

スコア7804

test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  $fluits1 = call_user_func('get_the_'.$this-> target_object,$post->ID, $this->param[0]);
20
20
 
21
- $fluits1 = call_user_func('get_the_'.$this-> target_object,$post->ID, $this->param[1]);
21
+ $fluits2 = call_user_func('get_the_'.$this-> target_object,$post->ID, $this->param[1]);
22
22
 
23
23
  ....
24
24
 

1

修正

2018/11/15 21:16

投稿

KazuhiroHatano
KazuhiroHatano

スコア7804

test CHANGED
@@ -2,9 +2,11 @@
2
2
 
3
3
  class Situmon{
4
4
 
5
- private $param;
5
+ private $target_object,$param;
6
6
 
7
- function __construct($param){
7
+ function __construct($target_object,$param){
8
+
9
+ $this-> target_object =$target_object;
8
10
 
9
11
  $this->param=$param;
10
12
 
@@ -14,9 +16,9 @@
14
16
 
15
17
  ....
16
18
 
17
- $fluits1 = get_the_terms( $post->ID, $this->param[0] );
19
+ $fluits1 = call_user_func('get_the_'.$this-> target_object,$post->ID, $this->param[0]);
18
20
 
19
- $fluits2 = get_the_terms( $post->ID, $this->param[1] );
21
+ $fluits1 = call_user_func('get_the_'.$this-> target_object,$post->ID, $this->param[1]);
20
22
 
21
23
  ....
22
24
 
@@ -26,13 +28,13 @@
26
28
 
27
29
 
28
30
 
29
- $situmon1=new Situmon(['形','色']);
31
+ $situmon1=new Situmon('posts',['形','色']);
30
32
 
31
33
  $situmon1->exec();
32
34
 
33
35
 
34
36
 
35
- $situmon2=new Situmon(['味','趣']);
37
+ $situmon2=new Situmon('terms',['味','趣']);
36
38
 
37
39
  $situmon2->exec();
38
40