Ejemplo n.º 1
0
        wp_enqueue_script('jplayer', get_template_directory_uri() . '/script/jplayer/js/jquery.jplayer.min.js');
    }
    wp_enqueue_script('respond', get_template_directory_uri() . '/script/respond/respond.src.js');
    wp_enqueue_script('scrollbutton', get_template_directory_uri() . '/script/scroll-button/scroll-button.js');
    wp_enqueue_script('jquery-ui-datepicker');
    if (is_singular()) {
        wp_enqueue_script('comment-reply');
    }
}
add_action('wp_enqueue_scripts', 'tk_add_scripts');
/*************************************************************/
/************CREATE TABLES**********************************/
/*************************************************************/
if (is_admin() && isset($_GET['activated']) && $pagenow == "themes.php") {
    create_table1();
    create_table2();
}
function create_table1()
{
    global $wpdb;
    $table_name = $wpdb->prefix . "revslider_sliders";
    $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " (\n                `id` int(9) NOT NULL AUTO_INCREMENT,\n                `title` tinytext NOT NULL,\n                `alias` tinytext,\n                `params` text NOT NULL,\n                PRIMARY KEY (`id`)\n              ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;";
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    if (dbDelta($sql)) {
        //TABLE CREATED!
    } else {
        //TABLE ISN'T CREATED
    }
}
function create_table2()
{
Ejemplo n.º 2
0
// ----------------------------------------------
// 	create function with default parameter
// ----------------------------------------------
// function can have default value parameter
//
function create_table2($data, $border = 1, $cellpadding = 4, $cellspacing = 4)
{
    echo "<table border = \"" . $border . "\" cellpadding=\"" . $cellpadding . "\" cellspacing=\"" . $cellspacing . "\">";
    reset($data);
    for ($i = 0; $i < sizeof($data); $i++) {
        // echo "<tr><td>" . $data[$i] . "</td></tr>\n";
        echo "<tr><td>{$data[$i]}</td></tr>\n";
    }
    echo "</table>";
}
create_table2($my_array);
// ----------------------------------------------
// 	create function that has vararg
// ----------------------------------------------
// -- three helper functions - func_num_args, func_get_arg(), func_get_args()
//
function var_args()
{
    echo "Number of parameters:";
    echo func_num_args();
    echo "<br />";
    $args = func_get_args();
    foreach ($args as $arg) {
        echo $arg . "<br />";
    }
}