无法从wordpress中的php函数获取样式

无法从wordpress中的php函数获取样式,php,wordpress,Php,Wordpress,我正在开发wordpress插件。我注册一个函数并使用if语句。代码是: function custom_twitter() { if($twitter!=''){ ?> <style type="text/css"> .google_area {top: 40px;} .youtube_area {top: 80px;} </style> <?php } if($twitter=''){ ?> <style type="

我正在开发wordpress插件。我注册一个函数并使用
if
语句。代码是:

function custom_twitter() {
if($twitter!=''){
?>
<style type="text/css">
    .google_area {top: 40px;}
    .youtube_area {top: 80px;}
</style>
<?php } if($twitter=''){ ?>

    <style type="text/css">
        .google_area {top: 80px;}
        .youtube_area {top: 120px;}
    </style> <?php

}

}
add_action('wp_head', 'custom_twitter');
函数自定义_twitter(){
如果($twitter!=''){
?>
.google_区域{top:40px;}
.youtube_区域{顶部:80px;}
.google_区域{top:80px;}
.youtube_区域{top:120px;}

global$twitter;
添加到函数中,或将其作为参数传递给函数。

在php中,使用
=
而不是
=
比较两个变量

function custom_twitter() {
if($twitter!=''){
?>
<style type="text/css">
    .google_area {top: 40px;}
    .youtube_area {top: 80px;}
</style>
<?php } if($twitter==''){ ?>

    <style type="text/css">
        .google_area {top: 80px;}
        .youtube_area {top: 120px;}
    </style> <?php

}

}
add_action('wp_head', 'custom_twitter');
函数自定义_twitter(){
如果($twitter!=''){
?>
.google_区域{top:40px;}
.youtube_区域{顶部:80px;}
.google_区域{top:80px;}
.youtube_区域{top:120px;}

$twitter到底是什么?我认为$twitter的值在代码中是空的。