sio*_*n45 1 php wordpress function
我的职能是什么:
$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)
如果您获得Twitter用户名
<?php echo get_option('to_twitter_feed'); ?>
Run Code Online (Sandbox Code Playgroud)
然后
你可以像这样在java脚本中设置twitter用户名
<script type='text/javascript'>
jQuery(function($){
$(".tweet").tweet({
username: "<?php echo get_option('to_twitter_feed'); ?>",
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)