Last active
August 29, 2015 14:14
-
-
Save hideokamoto/b997078b105ff41ba024 to your computer and use it in GitHub Desktop.
WordPressの検索・アーカイブ・著者ページ一覧にogp:imageを追加するfunctions.phpコード
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wp_head','add_ogp_img'); | |
function add_ogp_img(){ | |
if (is_archive() || is_author() || is_search()){ | |
$homeUrl = get_home_url(); | |
echo "<meta property='og:image' content='{$homeUrl}'/.png'>"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
作った経緯:https://ja.forums.wordpress.org/topic/147454?replies=5