[英]Custom WordPress Options Function
What is in my functions: 我的职能是什么:
$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" => ""),
In my WordPress options I have a custom twitter widget. 在我的WordPress选项中,我有一个自定义的twitter小部件。 I want users to be able to simply type their name in the input and have it inserted into the widget code.
我希望用户能够简单地在输入中键入他们的姓名,并将其插入到小部件代码中。 Most of this code is complete: basically, I just need to know how to put the what is called in first code below into the second code.
大部分代码是完整的: 基本上,我只需要知道如何将下面第一个代码中所说的内容放入第二个代码中即可。
How I call it: 我怎么称呼它:
<?php echo get_option('to_twitter_feed'); ?>
The code I need to put it into (where it says THEUSERNAME): 我需要将其放入(上面写着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>
if you get twitter username by 如果您通过获取Twitter用户名
<?php echo get_option('to_twitter_feed'); ?>
then 然后
you can set twitter username in java script like this 您可以像这样在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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.