私は実際に、ユーザーが使いやすくするために、wordpress スキンの input/output => show on skin オプションのようなスキン メニューを作成しています。しかし、私はロゴを表示しようとしてきましたが、失敗し続けています... CSS を PHP とマージして、関数名を取得できるようにしました。ただし、背景に画像は表示されません。
bg_image.php という名前の css/php ファイルを次に示します。
<?php header("Content-type: text/css"); ?>
#logo_main{
background:url('<?php echo get_settings('ld_header_img'); ?>') no-repeat;
}
それをヘッダーに含めることにより:
<link rel="stylesheet" type="text/css" href="./bg_image.php" />
そしてもちろん、機能するための配列などを持つfunctions.php...
$themename = "LightD";
$shortname = "ld";
$options = array (
array( "name" => $themename." Options",
"type" => "title"),
array( "name" => "Homepage",
"type" => "section"),
array( "type" => "open"),
array( "name" => "Homepage header image",
"desc" => "Enter the link to an image used for the homepage header.",
"id" => $shortname."_header_img",
"type" => "text",
"std" => ""),
array( "type" => "close"),
array( "name" => "Footer",
"type" => "section"),
array( "type" => "open"),
array( "name" => "Footer copyright text",
"desc" => "Enter text used in the right side of the footer. It can be HTML",
"id" => $shortname."_footer_text",
"type" => "text",
"std" => ""),
array( "type" => "close")
);
注記functions.php の完全なソース/サンプルは、以下のリンクにあります。このトピックを調べて、この情報を機能させました: http://net.tutsplus.com/tutorials/wordpress/how-to-create-a-better-wordpress-options-panel/
どこ:
name: 入力フィールドの名前。
desc: ユーザーに説明する簡単な説明。
id: 短い名前が前に付いたフィールドの ID。オプションの保存とアクセスに使用されます。
type: 入力タイプ – select、text、または textarea
options: 選択型入力のオプションの配列を宣言するために使用されます。
std: 他の入力が指定されていない場合に使用されるデフォルトの入力値。
これが私の質問の場所です... 内で「スタイル」を使用してみましたが、うまくいきました:
<div id="logo_main" style="background:url('<?php echo get_settings('ld_header_img'); ?>') no-repeat;">
<div id="branding">
<div id="blog-title"><?php if ( is_singular() ) {} else {echo '<h1>';} ?><a href="<?php echo /*home_url()*/"./home/" ?>/" title="<?php bloginfo( 'name' ) ?>" rel="home"><?php bloginfo( 'name' ) ?></a><?php if ( is_singular() ) {} else {echo '</h1>';} ?></div>
<p id="blog-description"><?php bloginfo( 'description' ) ?></p>
</div>
</div>
私の質問は; CSSed PHP が動かないのはなぜ?!