前提・実現したいこと
「メディアを追加」から追加した画像を任意のタグで囲い、かつその後ろにそのメディアのタイトルを表示するpタグをくっつけたいです。
出力したいもの
<article class="white-panel"> <img class="alignnone size-large wp-image-31" src="http://〇〇/wp-content/uploads/2018/01/〇〇.jpg" alt="" width="681" height="1024" /> <p class="title">タイトル</p> </article>
現状(タイトルが出力できません...)
<article class="white-panel"> <img class="alignnone size-large wp-image-31" src="http://〇〇/wp-content/uploads/2018/01/〇〇.jpg" alt="" width="681" height="1024" /> <p class="title"></p> </article>
該当のソースコード
php
1 2function.php 3 4<?php 5 6function my_image_send_to_editor( $html, $id, $caption, $title, $align, $url, $size ) { 7 8 9 $html = '<article class="white-panel">' .$html .'<p class="title">' . $title.'</p></article>'; 10 return $html; 11 12 13} 14 15add_action( 'image_send_to_editor', 'my_image_send_to_editor', 10 ,7); 16 17 18 ?> 19
不明瞭な点がありましたらご指摘いただければ幸いです。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/01/29 03:26