小编sio*_*n45的帖子

自定义WordPress选项功能

我的职能是什么:

$var = get_option('to_twitter_feed');

array( "name" => "Twitter Username",
    "desc" => "Enter your Twitter username for the Twitter feed",
    "id" => $shortname."_twitter_feed",
    "type" => "text",
    "std" => ""),
Run Code Online (Sandbox Code Playgroud)

在我的WordPress选项中,我有一个自定义的推特小部件.我希望用户能够在输入中简单地键入他们的名字并将其插入到widget代码中.大部分代码都是完整的:基本上,我只需要知道如何将下面第一个代码中调用的内容放入第二个代码中.

我怎么称呼它:

<?php echo get_option('to_twitter_feed'); ?>
Run Code Online (Sandbox Code Playgroud)

我需要把它放入的代码(它表示THEUSERNAME):

<script type='text/javascript'>
    jQuery(function($){
        $(".tweet").tweet({
            username: "THEUSERNAME",
            join_text: "auto",
            avatar_size: 32,
            count: 3,
            auto_join_text_default: "said,", 
            auto_join_text_ed: "we",
            auto_join_text_ing: "we were",
            auto_join_text_reply: "replied to",
            auto_join_text_url: "was checking out",
            loading_text: "loading tweets..."
        });
    });
</script>
Run Code Online (Sandbox Code Playgroud)

php wordpress function

1
推荐指数
1
解决办法
110
查看次数

这应该是它自己的样式表,以及如何?(PHP样式表?)

构建一个WordPress选项面板.它所做的一件事是允许用户选择自定义颜色.我使用默认样式表,然后调用自定义输入样式.但是,我只是将其插入到标题中,而不是将这些自定义值驻留在它们自己的样式表中(因为我需要通过PHP调用用户的选择).

举个例子,我的头文件中的代码如下:

<style type="text/css">
p a { <?php echo get_option('to_custom_css'); ?> }
</style>
Run Code Online (Sandbox Code Playgroud)

在我的功能:

array( "name" => "Custom CSS",  
    "desc" => "Want to add any custom CSS code? Put in here, and the rest is taken care of. This overrides any other stylesheets. eg: a.button{color:green}",  
    "id" => $shortname."_custom_css",  
    "type" => "text",  
    "std" => ""),    
Run Code Online (Sandbox Code Playgroud)

如何在仍然<?php echo get_option('to_custom_css'); ?>用于调用用户输入的同时将它驻留在自己的样式表中?

css php wordpress header

1
推荐指数
1
解决办法
117
查看次数

标签 统计

php ×2

wordpress ×2

css ×1

function ×1

header ×1