回答編集履歴

1

2017/10/26 07:41

投稿

退会済みユーザー
test CHANGED
@@ -35,3 +35,37 @@
35
35
  add_shortcode('shortcode1', 'shortcode');
36
36
 
37
37
  ```
38
+
39
+
40
+
41
+ **追記**
42
+
43
+ 単純にこうすれば良いんじゃないかと思います。
44
+
45
+ ```
46
+
47
+ function shortcode() {
48
+
49
+ require_once("phpQuery-onefile.php");
50
+
51
+ if(is_page('1')){
52
+
53
+ $html = file_get_contents("URL1");
54
+
55
+ }elseif(is_page('2')){
56
+
57
+ $html = file_get_contents("URL2");
58
+
59
+ }else{
60
+
61
+ $html = file_get_contents("URL3");
62
+
63
+ }
64
+
65
+ return phpQuery::newDocument($html)->find("#id名")->text();
66
+
67
+ }
68
+
69
+ add_shortcode('shortcode1', 'shortcode');
70
+
71
+ ```