Esempio n. 1
0
 function init()
 {
     //Do plugin loaded actions
     include "config/post__config.php";
     include "config/postmeta__config.php";
     $this->metaBoxes = getFieldConfig();
     //wp_enqueue_script( 'theme-plugins', get_template_directory_uri() . '/js/plugins.js');
     wp_enqueue_script('theme-functions', get_template_directory_uri() . '/js/main.js');
     wp_register_style('bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css');
     wp_enqueue_style('bootstrap');
 }
function save_proj_info($post_id, $post)
{
    /* Make all $wpdb references within this function refer to this variable */
    global $wpdb;
    /* Verify the nonce before proceeding. */
    if (!isset($_POST['smashing_flautist_access_nonce']) || !wp_verify_nonce($_POST['smashing_flautist_access_nonce'], basename(__FILE__))) {
        return $post_id;
    }
    /* Get the post type object. */
    $post_type = get_post_type_object($post->post_type);
    /* Check if the current user has permission to edit the post. */
    if (!current_user_can($post_type->cap->edit_post, $post_id)) {
        return $post_id;
    }
    /*PROCESS PROD DATA FROM HERE*/
    $groups = getFieldConfig();
    foreach ($groups as $g) {
        $g = $g["fields"];
        for ($i = 0; $i < count($g); $i++) {
            $curr_meta_value = get_post_meta($post_id, $g[$i][1], true);
            $new_meta_value = isset($_POST[$g[$i][1]]) ? $_POST[$g[$i][1]] : '';
            parseMetaValue($post_id, $g[$i][1], $curr_meta_value, $new_meta_value);
        }
    }
    /*END PROCESS PROD DATA*/
}