質問編集履歴
2
全体的なソースコードを修正/エラーは消えたため削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,6 +24,10 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
+
** (2018/10/17 14:00 ソースコードを修正しました) **
|
28
|
+
|
29
|
+
|
30
|
+
|
27
31
|
### 該当のソースコード
|
28
32
|
|
29
33
|
|
@@ -46,63 +50,115 @@
|
|
46
50
|
|
47
51
|
add_shortcode('hoge', 'my_php_Include');
|
48
52
|
|
53
|
+
```
|
49
54
|
|
55
|
+
```php
|
50
56
|
|
51
57
|
//hoge.php
|
52
58
|
|
53
|
-
<?php
|
59
|
+
<?php
|
54
60
|
|
55
61
|
$hogeargs = array(
|
56
62
|
|
57
|
-
'posts_per_page' =>
|
63
|
+
'posts_per_page' => 4,
|
58
64
|
|
59
65
|
'offset' => 0,
|
60
66
|
|
61
|
-
'
|
67
|
+
'orderby' => 'post_date',
|
62
68
|
|
63
|
-
'order' => '
|
69
|
+
'order' => 'DESC',
|
64
70
|
|
65
|
-
'post_type' =>
|
71
|
+
'post_type' => 'hogehoge',
|
66
72
|
|
67
73
|
'post_status' => 'publish',
|
68
74
|
|
69
75
|
'suppress_filters' => true,
|
70
76
|
|
77
|
+
'ignore_sticky_posts' => true,
|
78
|
+
|
79
|
+
'no_found_rows' => true
|
80
|
+
|
71
81
|
);
|
72
82
|
|
73
83
|
$hogePosts = get_posts($hogeargs);
|
74
84
|
|
75
|
-
if($hogePosts): ?>
|
85
|
+
if($hogePosts): ?>
|
76
86
|
|
77
|
-
<?php if($hogePosts) : foreach($hogePosts as $post) : setup_postdata( $post ); ?>
|
87
|
+
<?php if($hogePosts) : foreach($hogePosts as $post) : setup_postdata( $post ); ?>
|
78
88
|
|
79
|
-
<?php
|
89
|
+
<?php
|
80
90
|
|
81
|
-
|
91
|
+
//データ取得(Advanced custom field)
|
82
92
|
|
83
|
-
|
93
|
+
$data_a = get_field('data_a');
|
84
94
|
|
95
|
+
$data_b = get_field('data_b');
|
85
96
|
|
97
|
+
$data_c = get_field('data_c');
|
98
|
+
|
99
|
+
$data_d = get_field('data_d');
|
100
|
+
|
101
|
+
$data_e = get_field('data_e');
|
102
|
+
|
103
|
+
$data_f = get_field('data_f');
|
104
|
+
|
105
|
+
?>
|
106
|
+
|
107
|
+
<img src="<?php $data_a; ?>">
|
108
|
+
|
109
|
+
<?php the_title(); ?> //タイトルは出ますが「ショートコードを設置した固定ページのタイトル」が出る
|
110
|
+
|
111
|
+
<p>
|
112
|
+
|
113
|
+
<?php if($data_b === 'aa'){
|
114
|
+
|
115
|
+
echo '◯';
|
116
|
+
|
117
|
+
} elseif($data_b === 'bb'){
|
118
|
+
|
119
|
+
echo '●';
|
120
|
+
|
121
|
+
} ?>
|
122
|
+
|
123
|
+
/<?php echo $data_c; ?></p>
|
124
|
+
|
125
|
+
<?php
|
126
|
+
|
127
|
+
if(!empty($data_d)){
|
128
|
+
|
129
|
+
if( in_array( 'cc', $data_d ) ) {
|
130
|
+
|
131
|
+
echo '□';
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
if( in_array( 'dd', $data_d ) ) {
|
136
|
+
|
137
|
+
echo '■';
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
} ?>
|
142
|
+
|
143
|
+
<p><?php echo $data_e; ?></p>
|
144
|
+
|
145
|
+
<p><?php echo $data_f; ?></p>
|
146
|
+
|
147
|
+
<?php endforeach; ?>
|
148
|
+
|
149
|
+
<?php endif; ?>
|
150
|
+
|
151
|
+
<?php endif; ?>
|
86
152
|
|
87
153
|
```
|
88
154
|
|
89
155
|
```html
|
90
156
|
|
91
|
-
[
|
157
|
+
[hoge file='hoge']
|
92
158
|
|
93
159
|
```
|
94
160
|
|
95
161
|
|
96
|
-
|
97
|
-
### エラーコード
|
98
|
-
|
99
|
-
```
|
100
|
-
|
101
|
-
Warning: include(/home/httpd/html-ssl/www/hogehoge/wp-content/themes/hoge-theme/hoge.php) [function.include]: failed to open stream: No such file or directory in /home/httpd/html-ssl/www/hogehoge/wp-content/themes/hoge-theme/functions.php on line
|
102
|
-
|
103
|
-
Warning: include() [function.include]: Failed opening '/home/httpd/html-ssl/www/hogehoge/wp-content/themes/hoge-theme/hoge.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/httpd/html-ssl/www/hogehoge/wp-content/themes/hoge-theme/functions.php on line
|
104
|
-
|
105
|
-
```
|
106
162
|
|
107
163
|
### 試したこと
|
108
164
|
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -88,7 +88,7 @@
|
|
88
88
|
|
89
89
|
```html
|
90
90
|
|
91
|
-
[
|
91
|
+
[my_php_Include file='hoge']
|
92
92
|
|
93
93
|
```
|
94
94
|
|