Last active
August 29, 2015 14:08
-
-
Save mypacecreator/c4ff16f7bd13fa10e1bc to your computer and use it in GitHub Desktop.
「初心者でもプラグインを使わずにtitle,meta keyword,descriptionを投稿ごとに変える」の修正版(ブログ用)
This file contains 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
<?php if ( $post->my_description ): //meta descriptionの設定 ?> | |
<meta name="description" content="<?php echo esc_attr( $post->my_description ); ?>" /> | |
<?php else: ?> | |
<meta name="description" content="<?php bloginfo('description'); ?>" /> | |
<?php endif; ?> | |
<?php if ( $post->my_keywords ): //meta keywordsの設定 ?> | |
<meta name="keywords" content="<?php echo esc_attr( $post->my_keywords ); ?>" /> | |
<?php else: ?> | |
<meta name="keywords" content="デフォルトワード,デフォルトワード,デフォルトワード" /> | |
<?php endif; ?> | |
<?php if ( $post->my_title ): //titleタグの設定 ?> | |
<title><?php echo esc_html( $post->my_title ); ?></title> | |
<?php else: ?> | |
<title><?php wp_title( '|', true, 'right' ); ?><?php bloginfo('name'); ?></title> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment