2012-11-26 85 views
-2

我知道這是可能的,但我不能讓它工作。我知道我被卡住了,或者;或)函數裏面樣式裏面的回聲函數

所以,這裏是代碼:

function my_login_head() { 
    echo " 
    <style> 
    body.login #login h1 a {"; 
    <?php echo 
     "background: url("myfunction('image', get_template_directory_uri()      ."/images/image.png");?> ") no-repeat scroll center top transparent; 
    height: 90px; 
    width: 100px; 
    } 
    </style> 
    "; ?> 

我不能得到正確的標點符號。我只是想執行'myfunction',並獲得url的權利。

回答

3

試試這個:

<?php 
function my_login_head() { 
?> 
<style> 
body.login #login h1 a { 
    background: url("<?php echo myfunction('image',get_template_directory_uri().'/images/image.png'); ?>") no-repeat scroll center top transparent; 
    height: 90px; 
    width: 100px; 
} 
</style> 
<?php } ?> 
+0

非常感謝你,這個工作!我想到了這種方式,但無法得到正確的標點符號 –

+0

,非常歡迎! :) –

0
function my_login_head() { 
    echo " 
    <style> 
    body.login #login h1 a { 
     background: url(\"myfunction('image', " . get_template_directory_uri() 
     ."/images/image.png") . "\") no-repeat scroll center top transparent; 
    height: 90px; 
    width: 100px; 
    } 
    </style> 
    "; 

它仍然是相當意大利麪條混亂。使用模板

0
function my_login_head() { 
    echo " 
    <style> 
    body.login #login h1 a {"; 
    echo "background: url(".myfunction('image', get_template_directory_uri()."/images/image.png").") no-repeat scroll center top transparent; 
    height: 90px; 
    width: 100px; 
    } 
    </style> 
    "; 
0
<?php function my_login_head() { 
    echo " 
    <style> 
    body.login #login h1 a {"; 
    echo 
     "background: url(";myfunction('image', get_template_directory_uri()."/images/image.png"); ") no-repeat scroll center top transparent; 
    height: 90px; 
    width: 100px;" 

    } 
    echo "</style> "; } 
    ?> 
1
<?php 
function my_login_head() 
{ 
    ?> 
    <style type="text/css"> 
    #login h1 a { 
     background: url("<?php echo myfunction('image',get_template_directory_uri().'/images/image.png'); ?>") no-repeat scroll center top transparent; 
     height: 90px; 
     width: 100px; 
    } 
    </style> 

<?php 
} 
?>