{"id":12664,"date":"2024-05-26T07:00:14","date_gmt":"2024-05-25T22:00:14","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=12664"},"modified":"2024-05-12T05:46:00","modified_gmt":"2024-05-11T20:46:00","slug":"wordpress-%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%83%95%e3%82%a3%e3%83%bc%e3%83%ab%e3%83%89%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e5%85%ac%e9%96%8b%e6%99%82%e3%81%ab%e8%87%aa%e5%8b%95%e3%83%84%e3%82%a4","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=12664","title":{"rendered":"WordPress \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u4f7f\u3063\u3066\u516c\u958b\u6642\u306b\u81ea\u52d5\u30c4\u30a4\u30fc\u30c8\u3059\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u300c<strong>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 x \u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0<\/strong>\u300d\u3067\u65b0\u3057\u3044\u4fa1\u5024\u3092\u63a2\u308b\u3079\u304f<br \/>\n\u7814\u7a76\u3092\u7d9a\u3051\u3066\u308b\u4eca\u65e5\u3053\u306e\u9803\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u3068\u3057\u3066\u91cd\u8981\u306a<code>SNS<\/code>\u3001\u3068\u308a\u308f\u3051<code>X<\/code>\uff08Twitter\uff09\u3082\u9811\u5f35\u308d\u3046\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u305d\u308c\u306b\u95a2\u9023\u3059\u308b\u8a71\u984c\u3092\u304a\u5c4a\u3051\u3057\u307e\u3059\u3002<\/p>\n<p>\u30ba\u30d0\u30ea\uff01\u30c6\u30fc\u30de\u306f\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u4ed5\u7d44\u307f\u5316\uff08\u81ea\u52d5\u5316\uff09<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u306f<code>Console dot Log<\/code>\u306f\u5e38\u306b\u8a18\u4e8b\u3092\uff14\u3001\uff15\u500b\u30b9\u30c8\u30c3\u30af\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001<br \/>\n\u516c\u958b\u6642\u306b<code>Twitter API<\/code>\u3092\u4f7f\u3063\u3066\u3001\u81ea\u52d5\u3067\u304a\u77e5\u3089\u305b\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u3082\u3001\u30c4\u30a4\u30fc\u30c8\u5185\u5bb9\u304c\u307b\u307c\u540c\u3058\u306b\u306a\u3063\u3061\u3083\u3046\u306e\u3067\u300c<strong>\u3046\u30fc\u3093\u3001\u3060\u3063\u305f\u3089\u624b\u52d5\u3067\u4e88\u7d04\u6295\u7a3f\u3057\u3088\u3046\uff01<\/strong>\u300d\u3068\u306a\u3063\u305f\u3093\u3067\u3059\u304c\u3001\u3053\u308c\u3060\u3068\u5fd8\u308c\u3061\u3083\u3044\u307e\u3059\u3057\u3001\u306a\u306b\u3088\u308a\u4ed5\u7d44\u307f\u5316\u304c\u3067\u304d\u3066\u306a\u3044\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u203b \u3061\u306a\u307f\u306b\u3001\u4ed5\u7d44\u307f\u5316\u304c\u91cd\u8981\u306a\u306e\u306f\u300c<strong>\u6642\u9593\u5358\u4fa1\u304c\u9ad8\u3044\u4eba\u306e<\/strong><strong>\u4f5c\u696d\u306b\u96c6\u4e2d\u3067\u304d\u308b \uff1d \u3082\u3063\u3068\u5132\u304b\u308b<\/strong>\u300d\u304b\u3089\u3067\u3059\u306d\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f<code>WordPress<\/code>\u306e\u300c<strong>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9<\/strong>\u300d\u306b\u4e8b\u524d\u306b\u30c4\u30a4\u30fc\u30c8\u6587\u7ae0\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304d\u3001\u516c\u958b\u6642\u306b\u81ea\u52d5\u30c4\u30a4\u30fc\u30c8\u3059\u308b\u300c<strong>\u4ed5\u7d44\u307f\u5316<\/strong>\u300d\u3092\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002\ud83d\ude0a\u2728<\/p>\n<p>\u203b \u6ce8\u610f\uff1a\u3082\u3046\u3081\u3093\u3069\u3046\u306a\u306e\u3067\u3001\u300c<strong>Twitter<\/strong>\u300d\u3068\u300c<strong>\u30c4\u30a4\u30fc\u30c8<\/strong>\u300d\u3067\u7d71\u4e00\u3057\u307e\u3059\uff08\u7b11\uff09<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3566 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png\" alt=\"\" width=\"306\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png 306w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1-287x300.png 287w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/>\u300c\u30b9\u30d1\u30a4\u30d5\u30a1\u30df\u30ea\u30fc\u30de\u30f3\u30c1\u30e7\u30b3<br \/>\n\u8cb7\u3063\u305f\u3089\u3001<br \/>\n\u30a2\u30fc\u30cb\u30e3\u3061\u3083\u3093\u304c\u51fa\u307e\u3057\u305f\ud83d\ude0a\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> WordPress 6.5<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u3059\u3067\u306b<code>Twitter API<\/code>\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u4ee5\u4e0b\uff14\u3064\u306e\u30ad\u30fc\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u3002<\/p>\n<ul>\n<li>CONSUMER KEY\uff08API Key)<\/li>\n<li>CONSUMER SECRET \uff08API Secret\uff09<\/li>\n<li>ACCESS TOKEN\uff08Access Token\uff09<\/li>\n<li>ACCESS SECRET\uff08Access Secret\uff09<\/li>\n<\/ul>\n<p>\u306a\u304a\u3001API\u306e\u767b\u9332\u3084\u30ad\u30fc\u306e\u53d6\u5f97\u306f\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u304c\u308f\u304b\u308a\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n<p>\ud83d\udcdd\u00a0<a href=\"https:\/\/zenn.dev\/eito_blog\/articles\/a982fdb073493a\" target=\"_blank\" rel=\"noopener\">\u30102023\u5e74\u5ea6\u6700\u65b0\u7248\u3011Twitter API \u53d6\u5f97\u65b9\u6cd5<\/a><\/p>\n<p>\u3067\u306f\u4f5c\u696d\u306b\u79fb\u308a\u307e\u3057\u3087\u3046\u2757<\/p>\n<h1>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3068\u306f\uff1f<\/h1>\n<p>\u5b9f\u306f<code>WordPress<\/code>\u306b\u306f\u3001\u6700\u521d\u304b\u3089\u300c<strong>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9<\/strong>\u300d\u3068\u3044\u3046<strong>\u8a18\u4e8b\u4ee5\u5916\u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304f\u6a5f\u80fd<\/strong>\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001\u4f8b\u3048\u3070\u300c<strong>\u7def\u5ea6\u30fb<\/strong><strong>\u7d4c\u5ea6\u3092\u4fdd\u5b58\u3057\u3066\u304a\u3051\u3070\u3001\u81ea\u52d5\u3067\u5730\u56f3\u304c\u8868\u793a\u3055\u308c\u308b<\/strong>\u300d\u3068\u3044\u3046\u3088\u3046\u306a\u4f7f\u3044\u65b9\u3082\u3067\u304d\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u4eca\u56de\u306f\u3053\u306e\u6a5f\u80fd\u3067\u30c4\u30a4\u30fc\u30c8\u6587\u7ae0\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304f\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u203b\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6709\u52b9\u306b\u3059\u308b\u65b9\u6cd5\u306f <a href=\"#custom_fields\">\u3053\u3061\u3089<\/a><\/p>\n<h1>composer \u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p><code>WordPress<\/code>\u5185\u90e8\u3067\u306f<code>composer<\/code>\u3092\u4f7f\u3063\u3066\u306a\u3044\u306e\u3067\u3001\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u203b\u3061\u306a\u307f\u306b\u3001<code>2024.4.23<\/code>\u73fe\u5728\u3001<code>WordPress<\/code>\u306e<code>PHP 8<\/code>\u30b5\u30dd\u30fc\u30c8\u306f\u300c<strong>\u30d9\u30fc\u30bf\u30b5\u30dd\u30fc\u30c8<\/strong>\u300d\u3068\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001\u4eca\u56de\u306f\u30d5\u30eb\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b<code>PHP 7.4<\/code>\u3067\u8a71\u3092\u3059\u3059\u3081\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067<code>composer<\/code>\u306e\u521d\u671f\u5316\u3092\u3057\u307e\u3059\u3002<\/p>\n<div>\n<pre><strong>composer init<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u3044\u304f\u3064\u304b\u8cea\u554f\u3055\u308c\u307e\u3059\u304c\u3001\u5168\u3066\u30a8\u30f3\u30bf\u30fc\u30ad\u30fc\u3067\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<\/div>\n<p>\u305d\u3057\u3066\u3001<code>Twitter API<\/code>\u3092\u4f7f\u3046\u305f\u3081\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<div>\n<pre><strong>composer require abraham\/twitteroauth:4.0.1<\/strong><\/pre>\n<\/div>\n<p>\u203b\u5148\u307b\u3069\u66f8\u3044\u305f\u3088\u3046\u306b<code>PHP 7.4<\/code>\u5411\u3051\u306a\u306e\u3067\u30d0\u30fc\u30b8\u30e7\u30f3<code>4.0.1<\/code>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002\u3082\u3057<code>PHP 8<\/code>\u4ee5\u4e0a\u306e\u5834\u5408\u306f<code>composer require abraham\/twitteroauth<\/code>\u3068\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3053\u308c\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<h1>\u5b50\u30c6\u30fc\u30de\u5185\u3067\u30c4\u30a4\u30fc\u30c8\u6295\u7a3f\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u300c<strong>\u5b50\u30c6\u30fc\u30de<\/strong>\u300d\u3068\u547c\u3070\u308c\u308b<strong>\u3059\u3067\u306b\u3042\u308b\u30c6\u30fc\u30de\u3092\u7c21\u5358\u306b\u62e1\u5f35\u3067\u304d\u308b\u30c6\u30af\u30cb\u30c3\u30af<\/strong>\u3092\u4f7f\u3063\u3066\u81ea\u52d5\u30c4\u30a4\u30fc\u30c8\u3067\u304d\u308b\u3088\u3046\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u300c<strong>twentytwentyfour<\/strong>\u300d\u3092\u62e1\u5f35\u3057\u307e\u3059\u304c\u3001\u304a\u597d\u304d\u306a\u3082\u306e\u3092\u9078\u3093\u3067OK\u3067\u3059\uff01<\/p>\n<p>\u3067\u306f\u3001<code>WordPress<\/code>\u30d5\u30a9\u30eb\u30c0\u306e\u4e0b\u306b\u3042\u308b\u300c<strong>wp-content &gt; themes<\/strong>\u300d\u306e\u4e2d\u306b<code>twentytwentyfour-child<\/code>\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12674\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_5.png\" alt=\"\" width=\"701\" height=\"200\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_5.png 701w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_5-300x86.png 300w\" sizes=\"auto, (max-width: 701px) 100vw, 701px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u305d\u306e\u4e2d\u306b\u4ee5\u4e0b\uff12\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>style.css<\/strong><\/li>\n<li><strong>functions.php<\/strong><\/li>\n<\/ul>\n<p>\u4e2d\u8eab\u306f\u305d\u308c\u305e\u308c\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<br \/>\n<strong>\/wp-content\/themes\/twentytwentyfour-child\/style.css<\/strong><\/p>\n<div>\n<pre><strong>\/*<\/strong>\r\n<strong>Theme Name: Twenty Twenty-Four Child<\/strong>\r\n<strong>Theme URI: https:\/\/wordpress.org\/themes\/twentytwentyfour\/<\/strong>\r\n<strong>Author: the WordPress team<\/strong>\r\n<strong>Author URI: https:\/\/wordpress.org<\/strong>\r\n<strong>Description: Child version of the Twenty Twenty-Four theme<\/strong>\r\n<strong>Requires at least: 6.4<\/strong>\r\n<strong>Tested up to: 6.5<\/strong>\r\n<strong>Requires PHP: 7.0<\/strong>\r\n<strong>Version: 1.0.0<\/strong>\r\n<strong>License: GNU General Public License v2 or later<\/strong>\r\n<strong>License URI: http:\/\/www.gnu.org\/licenses\/gpl-2.0.html<\/strong>\r\n<strong>Text Domain: twentytwentyfour-child<\/strong>\r\n<strong>Tags: one-column, custom-colors, custom-menu, custom-logo, editor-style, featured-images, full-site-editing, block-patterns, rtl-language-support, sticky-post, threaded-comments, translation-ready, wide-blocks, block-styles, style-variations, accessibility-ready, blog, portfolio, news<\/strong>\r\n<strong>Template: twentytwentyfour<\/strong>\r\n<strong>*\/<\/strong><\/pre>\n<p><strong>\/wp-content\/themes\/twentytwentyfour-child\/functions.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>require_once ABSPATH .'vendor\/autoload.php'; \/\/ composer\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u8aad\u307f\u8fbc\u3080<\/strong>\r\n\r\n<strong>\/\/ \u672c\u6765\u306f\u3001wp-config.php \u3067\u5b9a\u7fa9\u3059\u3079\u304d\u3067\u3059<\/strong>\r\n<strong>define('TWITTER_CONSUMER_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXX');<\/strong>\r\n<strong>define('TWITTER_CONSUMER_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXX');<\/strong>\r\n<strong>define('TWITTER_ACCESS_TOKEN', 'XXXXXXXXXXXXXXXXXXXXXXXXX');<\/strong>\r\n<strong>define('TWITTER_ACCESS_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXX');<\/strong>\r\n\r\n<strong>add_action('wp_enqueue_scripts', function(){<\/strong>\r\n\r\n<strong>    wp_enqueue_style('parent-style', get_template_directory_uri() .'\/style.css');<\/strong>\r\n\r\n<strong>});<\/strong>\r\n\r\n<strong>function postTweet() {\r\n\r\n    $id = get_the_ID();\r\n    $post = get_post($id);\r\n\r\n    if($post-&gt;post_status !== 'publish') { \/\/ \u516c\u958b\u4e2d\u3058\u3083\u306a\u3044\u6642\u306f\u4f55\u3082\u3057\u306a\u3044\r\n\r\n        return;\r\n\r\n    }\r\n\r\n<strong>    $tweeted_at = get_post_meta($id, 'tweeted_at', true); \/\/ \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u304b\u3089\u30c4\u30a4\u30fc\u30c8\u3057\u305f\u65e5\u6642\u3092\u53d6\u5f97<\/strong>\r\n\r\n<strong>    if(empty($tweeted_at)) { \/\/ \u307e\u3060\u30c4\u30a4\u30fc\u30c8\u3057\u3066\u306a\u3044\u5834\u5408<\/strong>\r\n\r\n<strong>        $tweeted_at = date('Y-m-d H:i:s');<\/strong>\r\n<strong>        add_post_meta($id, 'tweeted_at', $tweeted_at, true);<\/strong>\r\n\r\n<strong>        $tweet_contents = get_post_meta($id, 'tweet_contents', true);<\/strong>\r\n\r\n<strong>        if(! empty($tweet_contents)) {<\/strong>\r\n\r\n<strong>            $post_title = $post-&gt;post_title;<\/strong>\r\n<strong>            $post_link = get_permalink($id);<\/strong>\r\n            \r\n<strong>            $targets = ['{title}', '{link}'];<\/strong>\r\n<strong>            $replacements = [$post_title, $post_link];<\/strong>\r\n<strong>            $tweet_contents = str_replace($targets, $replacements, $tweet_contents);<\/strong>\r\n\r\n<strong>            \/\/ \u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u753b\u50cf\u306e\u30d1\u30b9\u3092\u53d6\u5f97<\/strong>\r\n<strong>            $thumbnail_id = get_post_meta($id, '_thumbnail_id', true);<\/strong>\r\n<strong>            $attachment = wp_get_attachment_metadata($thumbnail_id);<\/strong>\r\n<strong>            $image_path = isset($attachment['file'])<\/strong>\r\n<strong>                ? wp_upload_dir()['basedir'] . '\/' . $attachment['file']<\/strong>\r\n<strong>                : null;<\/strong>\r\n\r\n<strong>            \/\/ \u3053\u3053\u3067Twitter API\u3092\u4f7f\u3063\u3066\u30c4\u30a4\u30fc\u30c8\u3059\u308b\u51e6\u7406\u3092\u66f8\u304f<\/strong>\r\n<strong>            $connection = new \\Abraham\\TwitterOAuth\\TwitterOAuth(<\/strong>\r\n<strong>                TWITTER_CONSUMER_KEY,<\/strong>\r\n<strong>                TWITTER_CONSUMER_SECRET,<\/strong>\r\n<strong>                TWITTER_ACCESS_TOKEN,<\/strong>\r\n<strong>                TWITTER_ACCESS_SECRET<\/strong>\r\n<strong>            );<\/strong>\r\n<strong>            $parameters = ['text' =&gt; $tweet_contents];<\/strong>\r\n\r\n<strong>            if(! is_null($image_path)) { \/\/ \u753b\u50cf\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u306f v1.1 \u3067\u884c\u3046<\/strong>\r\n\r\n<strong>                $connection-&gt;setApiVersion(1.1);<\/strong>\r\n<strong>                $media = $connection-&gt;upload('media\/upload', ['media' =&gt; $image_path]);<\/strong>\r\n\r\n<strong>                if(isset($media-&gt;media_id_string)) {<\/strong>\r\n\r\n<strong>                    $parameters['media'] = ['media_ids' =&gt; [$media-&gt;media_id_string]];<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>            $connection-&gt;setApiVersion(2);<\/strong>\r\n<strong>            $connection-&gt;post('tweets', $parameters, true); \/\/ \u6700\u65b0\u7248\u306f\u7b2c\uff13\u5f15\u6570\u304c\u914d\u5217\u306b\u306a\u3063\u3066\u307e\u3059<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>}<\/strong>\r\n<strong>add_filter('the_content', function($content){<\/strong>\r\n\r\n<strong>    if(is_single()) {<\/strong>\r\n\r\n<strong>        postTweet($content);<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n\r\n<strong>    return $content;<\/strong>\r\n\r\n<strong>});<\/strong><\/strong><\/pre>\n<\/div>\n<div>\n<p>\u306a\u304a\u3001\u30a2\u30d7\u30ed\u30fc\u30c1\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306e\u6d41\u308c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u8a18\u4e8b\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u304c\u3042\u308b<\/li>\n<li>post_meta \u306b tweeted_at \u304c\u4fdd\u5b58\u3055\u308c\u3066\u308b\u304b\u30c1\u30a7\u30c3\u30af<\/li>\n<li>\u3082\u3057\u4fdd\u5b58\u3055\u308c\u3066\u3044\u306a\u3044\u306a\u3089\u30c7\u30fc\u30bf\u3092\u52a0\u5de5\u3057\u3066\u81ea\u52d5\u30c4\u30a4\u30fc\u30c8<\/li>\n<li>tweeted_at \u3092\u4fdd\u5b58<\/li>\n<li>\u305d\u308c\u4ee5\u964d\u306f\u81ea\u52d5\u30c4\u30a4\u30fc\u30c8\u3055\u308c\u308b\u3053\u3068\u306f\u306a\u3044<\/li>\n<\/ol>\n<p>\u307e\u305f\u3001\u30b3\u30fc\u30c9\u4e2d\u306e\u4ee5\u4e0b\u90e8\u5206\u306b\u306f\u305d\u308c\u305e\u308c\u306e\u30ad\u30fc\u3092\u30bb\u30c3\u30c8\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\n<pre>\/\/ \u672c\u6765\u306f\u3001wp-config.php \u3067\u5b9a\u7fa9\u3059\u3079\u304d\u3067\u3059\r\n<strong>define('TWITTER_CONSUMER_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXX');<\/strong>\r\n<strong>define('TWITTER_CONSUMER_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXX');<\/strong>\r\n<strong>define('TWITTER_ACCESS_TOKEN', 'XXXXXXXXXXXXXXXXXXXXXXXXX');<\/strong>\r\n<strong>define('TWITTER_ACCESS_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXX');<\/strong><\/pre>\n<\/div>\n<h1>\u5916\u89b3\uff08\u30c6\u30fc\u30de\uff09\u3092\u5909\u66f4\u3059\u308b<\/h1>\n<\/div>\n<\/div>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30fc\u30de\u3092\u65b0\u3057\u3044\u3082\u306e\u3078\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\n\u30da\u30fc\u30b8\u5de6\u5074\u30e1\u30cb\u30e5\u30fc\u306e\u300c<strong>\u5916\u89b3<\/strong>\u300d\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12675\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_7.png\" alt=\"\" width=\"159\" height=\"298\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u300c<strong>Twenty Twenty-Four Child<\/strong>\u300d\u3068\u3044\u3046\u30c6\u30fc\u30de\u304c\u9078\u629e\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u306e\u3067\u3001\u300c<strong>\u6709\u52b9\u5316<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12676\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_6.png\" alt=\"\" width=\"765\" height=\"385\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_6.png 765w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_6-300x151.png 300w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/p>\n<p>\u3053\u308c\u3067\u30c6\u30fc\u30de\u8a2d\u5b9a\u3082\u5b8c\u4e86\u3067\u3059\uff01<\/p>\n<h1>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6709\u52b9\u306b\u3059\u308b\u65b9\u6cd5<\/h1>\n<p>\u307e\u305a\u3001\u753b\u9762\u5de6\u5074\u30e1\u30cb\u30e5\u30fc\u306b\u3042\u308b\u300c<strong>\u65b0\u898f\u6295\u7a3f\u3092\u8ffd\u52a0<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12665\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_4.png\" alt=\"\" width=\"159\" height=\"323\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_4.png 159w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_4-148x300.png 148w\" sizes=\"auto, (max-width: 159px) 100vw, 159px\" \/><\/p>\n<p>\u65b0\u3057\u3044\u8a18\u4e8b\u306e\u6295\u7a3f\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u30da\u30fc\u30b8\u53f3\u4e0a\u306b\u3042\u308b\u300c<strong>\ufe19<\/strong>\u300d\u304b\u3089\u300c<strong>\u8a2d\u5b9a<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12668\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_1.png\" alt=\"\" width=\"369\" height=\"753\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_1.png 369w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_1-147x300.png 147w\" sizes=\"auto, (max-width: 369px) 100vw, 369px\" \/><\/p>\n<p>\u8a2d\u5b9a\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u3053\u306e\u4e2d\u306b\u3042\u308b\u300c<strong>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9<\/strong>\u300d\u3092\u30aa\u30f3\u306b\u3057\u3001\u30ea\u30ed\u30fc\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12667\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_2.png\" alt=\"\" width=\"515\" height=\"559\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_2.png 515w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_2-276x300.png 276w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d5\u30a9\u30fc\u30e0\u304c\u753b\u9762\u4e0b\u306b\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12666\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_3.png\" alt=\"\" width=\"722\" height=\"203\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_3.png 722w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_3-300x84.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/p>\n<p>\u3053\u308c\u3067\u4f5c\u696d\u306f\u5b8c\u4e86\u3067\u3059\uff01<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\u3002\ud83d\ude0a\u2728<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u65b0\u898f\u6295\u7a3f\u30da\u30fc\u30b8\u3078\u79fb\u52d5\u3057\u3001\u8a18\u4e8b\u30bf\u30a4\u30c8\u30eb\u3068\u672c\u6587\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u672c\u984c\u306e\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3082\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>\u540d\u524d\uff1a<\/strong> tweet_contents<\/li>\n<li><strong>\u5024\uff1a<\/strong>\n<pre>{title}\r\n\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\uff01\r\n{link}\u305c\u3072\u898b\u3066\u306d\uff01\ud83d\ude0a<\/pre>\n<\/li>\n<li>\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u753b\u50cf\uff1a \u9069\u5f53\u306b\u9078\u629e<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12678\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_13.png\" alt=\"\" width=\"640\" height=\"531\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_13.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_13-300x249.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u3067\u306f\u3001\u3053\u308c\u3067\u4fdd\u5b58\u3057\u3066\u304b\u3089\u8a72\u5f53\u30da\u30fc\u30b8\u3078\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001<code>Twitter<\/code>\u306e\u65b9\u3078\u884c\u3063\u3066\u307f\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb\uff1f\uff1f<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12679\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_12.png\" alt=\"\" width=\"593\" height=\"720\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_12.png 593w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2024\/04\/wordpress_auto_tweet_12-247x300.png 247w\" sizes=\"auto, (max-width: 593px) 100vw, 593px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p>\u3046\u307e\u304f\u753b\u50cf\u3064\u304d\u3067\u30c4\u30a4\u30fc\u30c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<br \/>\n\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h1>\u3061\u306a\u307f\u306b<\/h1>\n<p>Twitter \u306e\u6587\u5b57\u5236\u9650\u306b\u5f15\u3063\u304b\u304b\u3089\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u306b\u306f\u3001<br \/>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3046\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\ud83d\udcdd <a href=\"https:\/\/threadcreator.com\/tools\/twitter-character-counter\" target=\"_blank\" rel=\"noopener\">Twitter Character Counter<\/a><\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u4eca\u56de\u306e\u3088\u3046\u306a<code>Twitter<\/code>\u3060\u3051\u306b\u9650\u3089\u305a\u3001<br \/>\n\u300c<strong>\u6642\u9593\u5358\u4fa1\u306e\u9ad8\u3044\u4f5c\u696d<\/strong>\u300d\u3092\u512a\u5148\u3057\u3066\u5b9f\u65bd\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u5316\u306f<br \/>\n<code>IT<\/code>\u30c6\u30af\u30ce\u30ed\u30b8\u30fc\u89aa\u548c\u6027\u304c\u9ad8\u304f\u3001\u304a\u5f79\u306b\u7acb\u3066\u308b\u3053\u3068\u304c\u671f\u5f85\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u305d\u3046\u3044\u3063\u305f\u6a5f\u80fd\u3092\u3054\u5e0c\u671b\u3067\u3057\u305f\u3089\u3001\u3044\u3064\u3067\u3082\u304a\u6c17\u8efd\u306b\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude0a<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>WordPress<\/code>\u306e\u8a18\u4e8b\u3092\u81ea\u52d5\u3067\u30c4\u30a4\u30fc\u30c8\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u4f5c\u696d\u306e\u81ea\u52d5\u5316\u3092\u884c\u3044\u3001\u3088\u308a\u6642\u9593\u5358\u4fa1\u304c\u9ad8\u3044\u4f5c\u696d\u3092\u512a\u5148\u3059\u308b\u65bd\u7b56\u3092\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u30db\u30f3\u30c8\u306b\u3061\u3087\u3063\u3068\u3057\u305f\u3053\u3068\u3067\u3059\u304c\u3001\u3053\u3046\u3044\u3063\u305f\u56de\u6570\u304c\u591a\u3044\u3082\u306e\u306f\u5f90\u3005\u306b\u52b9\u679c\u3092\u3060\u3057\u3066\u3044\u304f\u306e\u3067\u3001\u305c\u3072\u7686\u3055\u3093\u3082\u4ed5\u7d44\u307f\u5316\uff08\u81ea\u52d5\u5316\uff09\u3067\u304d\u308b\u3068\u3053\u306f\u30d5\u30eb\u306b\u3084\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9809 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9.png\" alt=\"\" width=\"370\" height=\"220\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/11\/no_9-300x178.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u6b21\u306f\u30d3\u30b8\u30cd\u30b9\u30e2\u30c7\u30eb<br \/>\n\u306e\u6709\u6599\u6559\u6750\u3067\u52c9\u5f37\u3060\u3042\uff01\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u300c\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 x \u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u300d\u3067\u65b0\u3057\u3044\u4fa1\u5024\u3092\u63a2\u308b\u3079\u304f \u7814\u7a76\u3092\u7d9a\u3051\u3066\u308b\u4eca\u65e5\u3053\u306e\u9803\u3067\u3059\u3002 \u305d\u3057\u3066\u3001\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u3068\u3057\u3066\u91cd\u8981\u306aSNS\u3001\u3068\u308a\u308f\u3051X\uff08T &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=12664\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;WordPress \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u4f7f\u3063\u3066\u516c\u958b\u6642\u306b\u81ea\u52d5\u30c4\u30a4\u30fc\u30c8\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":12686,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59,259],"tags":[192],"class_list":["post-12664","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","category-259","tag-twitter"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12664"}],"version-history":[{"count":15,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12664\/revisions"}],"predecessor-version":[{"id":12689,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12664\/revisions\/12689"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/12686"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}