<!-- OGP --> <meta property="og:type" content="blog"> <?php if (is_single()){//単一記事ページの場合 if(have_posts()): while(have_posts()): the_post(); echo '<meta property="og:description" content="'.mb_substr(get_the_excerpt(), 0, 100).'">';echo "\n";//抜粋を表示 endwhile; endif; echo '<meta property="og:title" content="'; the_title(); echo '">';echo "\n";//単一記事タイトルを表示 echo '<meta property="og:url" content="';
![プラグイン不要でFacebook OGPをコピペでサクッと設置する方法|WordPressカスタマイズ](https://cdn-ak-scissors.b.st-hatena.com/image/square/5f090178f58aaa8cad4783ea89e87dc4231506a4/height=288;version=1;width=512/https%3A%2F%2Fnelog.jp%2Fwp-content%2Fuploads%2F2017%2F03%2FFacebook.jpg)