bloginfo()でWordPressの情報を出力する

bloginfo( )を使用してWordPressの様々な情報を出力できます。

WordPress Codex

bloginfo( )の使い方

<?php bloginfo( $show ); ?> 

$showに下記のようにパラメータを入れる事でそれそれの情報を表示できます。

使用例

ブログタイトルをリンク付きで表示するには下記の様に記入します

<h1>
<a href="<?php bloginfo('url'); ?>">
<?php bloginfo('name'); ?>
</a>   
</h1>

スタイルシート(style.css)へのパスを表示するには下記の様に記入します。

<link rel="stylesheet" href="stylesheet_url"  />

パラメータ

■ ヘッダーに表示するパラメータ

'charset' //文字コード
'html_type' //Content-type(text/html)
'language' //言語
'version' //バージョン

■ 基本情報の表示するパラメータ

'name'     //ブログの名前   
'description'     //ブログの説明     
'admin_email'   //管理者のメールアドレス    

■ URLを取得するパラメータ

'url'  // サイトのURL                
例 = http://example/home

'wpurl' //  WordPress本体のURL            
例 = http://example/home/wp

'stylesheet_directory' // style.cssがあるディレクトリ 
例 = http://example/home/wp/wp-content/themes/child-theme

'stylesheet_url' //  style.cssのURL    
例 = http://example/home/wp/wp-content/themes/child-theme/style.css

'template_directory' //  テンプレートファイルのあるディレクトリ
例 = http://example/home/wp/wp-content/themes/parent-theme

'template_url'  // テンプレートファイルのURL      
例 = http://example/home/wp/wp-content/themes/parent-theme

■ フィードのURLを取得するパラメータ

'atom_url'    //  AtomフィードURL      
例 = http://example/home/feed/atom

'rss2_url'   //   RSS 2.0 のフィードURL
例 = http://example/home/feed

'rss_url'    //    RSS 0.92 のフィードURL)     
例 = http://example/home/feed/rss

'pingback_url'    //    ピンバック用URL
例 = http://example/home/wp/xmlrpc.php

'comments_atom_url'   //コメントのAtomフィードURL
例 = http://example/home/comments/feed/atom

'comments_rss2_url'    //コメントのRSSフィードURL
例 = http://example/home/comments/feed

Related Article

No Comments & Tracbacks

Leave a Comment

Emailは公開されません。*は必須項目です。


*


Categorys

Tags

CSS3 ダッシュボード ヘッダー トラブル コードサンプル スライドショー コンテンツ jQueryプラグイン 素材 引っ越し php お知らせ Facebook JavaScript CSS カテゴリー IE 投稿タイプ seo Photoshop Shareボタン HTML5 レスポンシブ サイドバー ナビゲーション タクソノミー WPセキュリティ Git カスタムメニュー Macアプリ PHPリファレンス SVG query_posts API WP使い方 iTunes データベース コメント function RSS 条件分岐 get_posts() スマートフォン Sass/Compass マルチサイト機能