正しい場所は functions.php です。次のようにフィルターを追加します。
function add_post_content($content) {
$content .= $buttonCode
return $content;
}
add_filter('the_content', 'add_post_content');
これが役に立てば幸いです、ジェイソン
[アップデート]
このために、提供したコードがボタンコードであると想定しています。そうでない場合は、正しいボタンコードに置き換えてください。
テーマ フォルダーで functions.php を開き、これを一番下に追加します。
追加する投稿の下に配置するには:
function add_post_content($content) {
$buttonCode = "<div data-bg-color=\"#fdfdfa\" class=\"rdbWrapper\" data-show-read=\"1\" data-show-send-to-kindle=\"0\" data-show-print=\"0\" data-show-email=\"0"\ data-orientation=\"0\" data-version=\"1\"></div><script type=\"text/javascript\">(function() {var s = document.getElementsByTagName(\"script\")[0],rdb = document.createElement(\"script\"); rdb.type = \"text/javascript\"; rdb.async = true; rdb.src = document.location.protocol + \"//www.readability.com/embed.js\"; s.parentNode.insertBefore(rdb, s); })();</script>";
$content .= $buttonCode
return $content;
}
add_filter('the_content', 'add_post_content');
追加する投稿の上に配置するには:
function add_post_content($content) {
$buttonCode = "<div data-bg-color=\"#fdfdfa\" class=\"rdbWrapper\" data-show-read=\"1\" data-show-send-to-kindle=\"0\" data-show-print=\"0\" data-show-email=\"0"\ data-orientation=\"0\" data-version=\"1\"></div><script type=\"text/javascript\">(function() {var s = document.getElementsByTagName(\"script\")[0],rdb = document.createElement(\"script\"); rdb.type = \"text/javascript\"; rdb.async = true; rdb.src = document.location.protocol + \"//www.readability.com/embed.js\"; s.parentNode.insertBefore(rdb, s); })();</script>";
$content = $buttonCode . $content;
return $content;
}
add_filter('the_content', 'add_post_content');