函数里面的样式里面回声函数

时间:2012-11-26 11:07:46

标签: php css wordpress function

我知道这是可能的,但我无法让它发挥作用。我知道我会被“或”所困扰;或)

所以,这是代码:

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属性。

5 个答案:

答案 0 :(得分: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 } ?>

答案 1 :(得分: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 
} 
?>

答案 2 :(得分: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>
    ";

仍然很意大利面。使用模板

答案 3 :(得分: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>
    ";

答案 4 :(得分: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> "; }
    ?>
相关问题