我的职能是什么:
$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" => ""),
在我的WordPress选项中,我有一个自定义的推特小部件。我希望用户能够在输入中简单地键入他们的名字并将其插入到widget代码中。大部分代码都是完整的:基本上,我只需要知道如何将下面第一个代码中调用的内容放到第二个代码中。
我如何称呼它:
<?php echo get_option('to_twitter_feed'); ?>
我需要将其放入的代码(其中显示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>
答案 0 :(得分:7)
如果您通过
获得推特用户名<?php echo get_option('to_twitter_feed'); ?>
然后
你可以像这样在
中设置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>