HTML,CSS,PHP,ワードプレスカスタマイズ 技術情報資料

WordPress のパス

サイト

・URL
echo home_url(); //----結果 http://yuzumaru.co.jp 

・末尾に / を付加する場合
echo home_url('/'); //----結果 http://yuzumaru.co.jp/

WordPressの入っているサイトURL

・URL
echo site_url(); //----結果 http://yuzumaru.co.jp/wp

・末尾に / を付加する場合
echo site_url('/'); //----結果 http://yuzumaru.co.jp/wp/

WordPress ディレクトリ

echo ABSPATH; //----結果 /var/www/html/wp/
※末尾に / が付いていることに注意

サイト ディレクトリ

echo ABSPATH; //----結果 /var/www/html/wp/

テーマのURL

// http://wp/wp-content/themes/theme999/style.css
$theme_urls='<?php echo get_stylesheet_directory_uri(); ?>/style.css`;
// /var/www/html/wp/wp-content/themes/theme999/style.css
$theme_path='<?php echo bloginfo('template_directory'); ?>/style.css`;

テーマのパス

// 親テーマのディレクトリのパス
// /var/www/html/wp/wp-cotent/themes/parent
echo TEMPLATEPATH;
echo get_template_directory();

// 子テーマのディレクトリのパス
// /var/www/html/wp/wp-cotent/themes/child
echo STYLESHEETPATH;
echo get_stylesheet_directory();

プラグインディレクトリのパス

echo WP_CONTENT_DIR;  // /var/www/html/wp/wp-content
echo WP_CONTENT_URL;  // http://yuzumaru.co.jp/wp/wp-content
//
echo WP_PLUGIN_DIR;  // /var/www/html/wp/wp-content/plugins
echo WP_PLUGIN_URL;  // http://yuzumaru.co.jp/wp/wp-content/plugins
// 推奨↓
echo plugins_url(); // http://yuzumaru.co.jp/wp-content/plugins

プラグインの場所とりだし

$plugin_dir = str_replace(basename(__FILE__),"",plugin_basename(__FILE__));
//DIR
$plugin_mydir = WP_PLUGIN_DIR.'/'.$plugin_dir;
//URL
$plugin_myurl = WP_PLUGIN_URL.'/'.$plugin_dir;

サムネイル URL

<?php 
$thumbnail_id = get_post_thumbnail_id(); 
$thumbnail_ul = wp_get_attachment_image_src( $thumbnail_id , '画像サイズ' ); 
?>
$thumbnail_ul
[0] => サムネイルURL
[1] => 幅
[2] => 高さ

画像サイズ

サムネイル:thumbnail
中サイズ:medium
大サイズ:large
フルサイズ:full

ワードプレスのブログ情報URL

書式 get_bloginfo(‘para’)
para意味取り込み例
admin_email管理者メールアドレスget_bloginfo( “para” )
atom_urlアトムURLadmin@yuzumaru.com
charsetWPのキャラクタセットhttp://www.yuzumaru.com/home/feed/atom
comments_atom_urlコメントアトムURLUTF-8
comments_rss2_urlコメントアトムURLフィードURLhttp://www.yuzumaru.com/home/comments/feed/atom
descriptionディスクリプションhttp://www.yuzumaru.com/home/comments/feed
homeサイトURLJust another WordPress blog
html_typeHTMLタイプhttp://www.yuzumaru.com/home
language言語text/html
nameサイトタイトルen-US
pingback_urlxmlrpc URL (CGI直書きなどで利用)
rdf_urlrdf URLhttp://www.yuzumaru.com/home/wp/xmlrpc.php
rss2_urlフィードURLhttp://www.yuzumaru.com/home/feed/rdf
rss_urlrss URLhttp://www.yuzumaru.com/home/feed
siteurlサイト URLhttp://www.yuzumaru.com/home/feed/rss
stylesheet_directoryテーマパスURLhttp://www.yuzumaru.com/home
stylesheet_urlテーマ スタイルシート URLhttp://www.yuzumaru.com/home/wp/wp-content/themes/largo
template_directoryテーマ URLhttp://www.yuzumaru.com/home/wp/wp-content/themes/largo/style.css
template_urlテーマ URLhttp://www.yuzumaru.com/home/wp/wp-content/themes/largo
text_directionhttp://www.yuzumaru.com/home/wp/wp-content/themes/largo
urlサイトURLltr
versionWP バージョンhttp://www.yuzumaru.com/home
wpurlWP URL3.5

スポンサーリンク

関連記事

スポンサーリンク

カテゴリー