跳转到内容

User:靈車甩尾棺材甩/tabber-widget.php

维基百科,自由的百科全书
<?php
// 建立 widget

class TabberWidget extends Widget {

function TabberWidget() {
     $widget_ops = array(
     'classname' => 'TabberWidget',
     'description' => 'Simple jQuery Tabber Widget'
);
$this->Widget(
     'TabberWidget',
     'Beginner Tabber Widget',
     $widget_ops
);
}

function widget($args, $instance) {

function tabber() {

register_style('tabber-style', plugins_url('tabber-style.css', __FILE__));
register_script('tabber-widget-js', plugins_url('tabber.js', __FILE__), array('jquery'));
enquene_style('tabber-style');
enquene_script('tabber-widget-js');
}

extract($args, EXTR_SKIP);
// pre-weight code from theme
echo $before_widget;
$tabs = tabber();
// 輸出 tabs HTML
echo $tabs;
// post-widget code from theme
echo $after_widget;
}
}

// registering , loading widget
add_action(
'widgets_init',
create_function('','return register_widget("TabberWidget");')
);
?>