| 
 | 
 
Facebook Open Graph Meta Tags 
 
這個好像是自己亂湊出來的? 不知道是不是很完整正確,總之還勉強能用。 
使用方法: 
直接把下面代碼寫在布景主題的 header.php 檔案中的適當位置,不用另外安裝什麼外掛,一樣堪用... 
- <meta property="og:locale" content="zh_TW"/>
 
 - <meta property="og:type" content="article"/>
 
 - <meta property="og:title" content="<?php wp_title( '|', true, 'right' ); ?>"/>
 
 - <meta property="og:description" content="<?php
 
 -         global $post;
 
 -         if ( is_singular() ) {
 
 -         if ( $post->post_excerpt ) {
 
 -         $post_excerpt = $post->post_excerpt;
 
 -         } else {
 
 -         $post_excerpt = trim( str_replace( "\r\n", ' ', strip_tags( $post->post_content ) ) );
 
 -         }
 
 -         $description = mb_substr( $post_excerpt, 0, 150, 'UTF-8' );
 
 -         $description .= ( mb_strlen( $post_excerpt, 'UTF-8' ) > 150 ) ? '...' : '';
 
 -         printf('%s', $description);
 
 -         }
 
 -         ?>"/>
 
 - <meta property="og:url" content="http://<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ?>"/>
 
 - <meta property="og:site_name" content="重灌狂人"/>
 
  複製代碼 
 
 
 |   
 
 
 
 |