質問編集履歴

2

追記しました

2020/02/13 15:35

投稿

mykyofit
mykyofit

スコア28

test CHANGED
File without changes
test CHANGED
@@ -106,6 +106,78 @@
106
106
 
107
107
 
108
108
 
109
+ ### 参考サイトを元にfunctions.phpに記述した内容
110
+
111
+ 表示されれば問題なかったので、一旦以下に修正しています。
112
+
113
+ ```/** Register short code */
114
+
115
+ add_shortcode( 'capitalp_author', function( $attributes = [], $content = '' ) {
116
+
117
+ static $users = [];
118
+
119
+ $author_id = get_the_author_meta( 'ID' );
120
+
121
+ ob_start();
122
+
123
+ ?>
124
+
125
+ <p class="<? echo $author_id; ?>"><? echo $content; ?></p>
126
+
127
+ <?php
128
+
129
+ $content = ob_get_contents();
130
+
131
+ ob_end_clean();
132
+
133
+ return $content;
134
+
135
+ } );
136
+
137
+ /** Register short code UI */
138
+
139
+ add_action( 'register_shortcode_ui', function() { // Interviews
140
+
141
+ shortcode_ui_register_for_shortcode( 'capitalp_author', [
142
+
143
+ 'label' => '著者の発言',
144
+
145
+ 'post_type' => [ 'post' ],
146
+
147
+ 'listItemImage' => 'dashicons-format-status',
148
+
149
+ 'inner_content' => [
150
+
151
+ 'label' => '発言内容',
152
+
153
+ 'description' => '自動で改行が入ります。',
154
+
155
+ ],
156
+
157
+ 'attrs' => [
158
+
159
+ [
160
+
161
+ 'label' => '発言者',
162
+
163
+ 'attr' => 'user_id',
164
+
165
+ 'type' => 'user_select',
166
+
167
+ 'multiple' => false,
168
+
169
+ ],
170
+
171
+ ],
172
+
173
+ ] );
174
+
175
+ } );
176
+
177
+ ```
178
+
179
+
180
+
109
181
  大変恐縮ですが、解決策をお知りの方、
110
182
 
111
183
  いらっしゃいましたら少しでも構いません。

1

内容の追加

2020/02/13 15:34

投稿

mykyofit
mykyofit

スコア28

test CHANGED
File without changes
test CHANGED
@@ -90,6 +90,20 @@
90
90
 
91
91
 
92
92
 
93
+ ### 追記です
94
+
95
+ 参考URLの手順をそのまま、コードをすべて
96
+
97
+ functions.phpに追加したところ、表示はされたのですが、
98
+
99
+ ここから上記の作成したショートコードにカスタマイズ・
100
+
101
+ 置き換えるのが分かりません。
102
+
103
+ 上記を追加すると仮定した上でコードをご教授頂けますと助かります。
104
+
105
+
106
+
93
107
 
94
108
 
95
109
  大変恐縮ですが、解決策をお知りの方、