开发者

Custom WordPress Options Function

开发者 https://www.devze.com 2023-04-08 06:19 出处:网络
What is in my functions: $var = get_option(\'to_twitter_feed\'); array( \"name\" => \"Twitter Username\",

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. 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):

<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

<?php echo get_option('to_twitter_feed'); ?>

then

you can set twitter username in java script like this

<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>
0

精彩评论

暂无评论...
验证码 换一张
取 消