0
私は私のfunction.phpファイルに次のCSSの条件文があります。function.phpファイル(Wordpress)からCSS文を初期化する方法は?
function logo_exists() {
global $options;
?><style type="text/css">
#header h1 a {
<?php
if ($options['logo'] == NULL) { ?>
float: left;
text-indent: 0;
<?php } else { ?>
background: url(<?php echo $options['logo']; ?>) no-repeat scroll 0 0;
float: left;
text-indent: -9999px;
width: 160px;
height: 80px;
}
<?php } ?>
</style><?php
}
は、例:
(...same code as above...)
width: 160px;
height: 80px;
}
<?php } ?>
</style><?php
add_option('logo_exists');
}
を私は "追加" またはするかどうかはわかりませんそれを "初期化する"。
私は試しました:add_option( 'logo_exists');とadd_action( 'logo_exists');しかしそれはうまくいかなかった。
function.phpファイルの条件付きCSS文に対するWordpressの「追加」コマンドとは何ですか?上のよう is_home()
is_singular()
(ページ/記事のための)is_single()
is_page()
広告:代わりに、この変化を使用しての
これはあなたの他の質問と重複していませんか? :http://stackoverflow.com/questions/4482702/how-to-initialise-css-statements-from-the-function-php-file-wordpress – t31os
おっと、私はこれを意味しました:http://stackoverflow.com/質問/ 4482295/php-conditional-statements-within-wordpresss-function-php-file-not-working – t31os