Wordpress+PHP:将选项值转换为变量


Wordpress + PHP: Getting Option Value into Variable

我相信这对你们来说一定很容易,但我很难将主题选项值放入其中一个变量中。

在下面的代码中,我必须使用"作为值,我允许用户从wordpress主题选项面板插入该值。我不知道如何设置,这样我就可以在这个变量中获得主题选项值。

$rate_size="echo get_option('mp_star_size')",

我试过

$rate_size="'.echo get_option('mp_star_size').'",

但它给了我语法错误,所以不知道我应该使用什么语法。

好的,这里是更多的细节,我正试图得到

以下代码:

    wp_gdsr_render_article(
            $stars_set="",
            $stars_size=0,
            $stars_set_ie6="",
            $echo=true
        );

我想让我的主题用户从wordpress主题中的主题选项面板中选择选项。所以我想用echo get_option()设置类似的东西,这样我就可以从选项面板中获得该代码的每个参数的值。

示例:

    wp_gdsr_render_article(
            $stars_set="here is my theme option",
            $stars_size=here is my theme option,
            $stars_set_ie6="here is my theme option",
            $echo=here is my theme option
        );
$rate_size = get_option('mp_star_size');

echo仅用于在页面上显示内容。