回答編集履歴
1
answer
CHANGED
@@ -57,4 +57,24 @@
|
|
57
57
|
return $id4;
|
58
58
|
}
|
59
59
|
add_shortcode('shortcode4', 'shortcode4');
|
60
|
+
```
|
61
|
+
|
62
|
+
いまいちよく分からないですが、こういうことですか?
|
63
|
+
```
|
64
|
+
function shortcode() {
|
65
|
+
require_once("phpQuery-onefile.php");
|
66
|
+
if(is_page('1')){
|
67
|
+
$html = file_get_contents("URL1");
|
68
|
+
}elseif(is_page('2')){
|
69
|
+
$html = file_get_contents("URL2");
|
70
|
+
}else{
|
71
|
+
$html = file_get_contents("URL3");
|
72
|
+
}
|
73
|
+
$id = phpQuery::newDocument($html)->find("#id名")->text();
|
74
|
+
$id2 = phpQuery::newDocument($html)->find("#id名2")->text();
|
75
|
+
$id3 = phpQuery::newDocument($html)->find("#id名3")->text();
|
76
|
+
$id4 = phpQuery::newDocument($html)->find("#id名4")->text();
|
77
|
+
return $id.$id2.$id3.$id4;
|
78
|
+
}
|
79
|
+
add_shortcode('shortcode', 'shortcode');
|
60
80
|
```
|