Created
June 29, 2012 06:54
-
-
Save s-hiroshi/3016365 to your computer and use it in GitHub Desktop.
WordPress > shortcode > bloginfo
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 | |
/** | |
* 入力エディタでbloginfoを取得する。 | |
* @param arg bloginfoの引数 | |
* url ブログのURL | |
* template_directory テンプレートディレクトリのパス | |
* stylesheet_directory テーマディレクトリのパス | |
* デフォルトではblogのURLを返す | |
*/ | |
function bloginfo_func($atts) { | |
extract(shortcode_atts(array( | |
'arg' => "url" | |
), $atts)); | |
if ('' !== $arg) { | |
$value = get_bloginfo($arg); | |
} else { | |
$value = get_bloginfo('url'); | |
} | |
return $value; | |
} | |
add_shortcode('bloginfo', 'bloginfo_func'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment