function wck_stp_single_listing($name, $single)
{
    // get information from Swift Template CPT
    $args = array('post_type' => 'wck-swift-template', 'post_status' => 'publish', 'posts_per_page' => -1, 'numberposts' => -1);
    $stp_posts = get_posts($args);
    // variable to store if we have a valid shortcode
    $valid_shortcode = false;
    foreach ($stp_posts as $stp_post) {
        if ($name == Wordpress_Creation_Kit::wck_generate_slug($stp_post->post_title)) {
            // we have a valid shortcode
            $valid_shortcode = true;
            $stp_id = $stp_post->ID;
            // find out the CPT we're quering from Swift Arguments
            $stp_cpt_name = get_post_meta($stp_id, 'wck_stp_args_cpt', true);
            // get information from the current post queried in the front-end by our shortcode
            $mustache_vars = wck_stp_generate_mustache_single_array($single, $stp_cpt_name);
            $template = get_post_meta($stp_id, 'wck_stp_template_single', true);
            $m = new Mustache_Engine();
            $content = '<div class="stp-bubble-wrap stp-single stp-single-' . $name . '">' . $m->render($template, $mustache_vars) . '</div>';
            return apply_filters('wck_stp_template_content_single', do_shortcode($content), $content);
        }
    }
    if (!$valid_shortcode) {
        return '<p class="wck-stp-error">' . sprintf(__('The single listing post with the name <em>%s</em> dose not exist.', 'wck'), $name) . '</p>';
    }
}
Пример #2
0
function wck_cfc_change_field_title($meta, $id, $values, $element_id)
{
    global $wpdb;
    if ($meta == 'wck_cfc_fields') {
        $wck_cfc_fields = get_post_meta($id, 'wck_cfc_fields', true);
        if ($wck_cfc_fields[$element_id]['field-title'] != $values['field-title']) {
            $wck_cfc_args = get_post_meta($id, 'wck_cfc_args', true);
            $meta_name = $wck_cfc_args[0]['meta-name'];
            $post_id_with_this_meta = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = %s", $meta_name));
            if (!empty($post_id_with_this_meta)) {
                foreach ($post_id_with_this_meta as $post) {
                    $results = get_post_meta($post->post_id, $meta_name, true);
                    if (!empty($results)) {
                        foreach ($results as $key => $result) {
                            $results[$key][Wordpress_Creation_Kit::wck_generate_slug($values['field-title'])] = $results[$key][Wordpress_Creation_Kit::wck_generate_slug($wck_cfc_fields[$element_id]['field-title'])];
                            unset($results[$key][Wordpress_Creation_Kit::wck_generate_slug($wck_cfc_fields[$element_id]['field-title'])]);
                        }
                    }
                    update_post_meta($post->post_id, $meta_name, $results);
                }
            }
        }
    }
}
Пример #3
0
<?php

/* @param string $meta Meta name.	 
 * @param array $details Contains the details for the field.	 
 * @param string $value Contains input value;
 * @param string $context Context where the function is used. Depending on it some actions are preformed.;
 * @return string $element input element html string. */
$element .= '<textarea name="' . $single_prefix . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details)) . '" id="';
if (!empty($frontend_prefix)) {
    $element .= $frontend_prefix;
}
$element .= esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details)) . '" style="vertical-align:top;" class="mb-textarea mb-field">' . esc_html($value) . '</textarea>';
Пример #4
0
            }
        } else {
            $option_parts = explode('%', $option);
            if (!empty($option_parts)) {
                if (empty($option_parts[0]) && count($option_parts) == 3) {
                    $label = $option_parts[1];
                    $value_attr = $option_parts[2];
                    if (in_array($option_parts[2], $values)) {
                        $found = true;
                    }
                }
            }
        }
        $element .= '<div><label><input type="checkbox" name="' . $single_prefix . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details));
        if ($this->args['single'] && $this->args['context'] != 'option') {
            $element .= '[]';
        }
        $element .= '" id="';
        if (!empty($frontend_prefix)) {
            $element .= $frontend_prefix;
        }
        /* since the slug below is generated from the value as well we need to determine here if we have a slug or not and not let the wck_generate_slug() function do that */
        if (!empty($details['slug'])) {
            $slug_from = $details['slug'];
        } else {
            $slug_from = $details['title'];
        }
        $element .= esc_attr(Wordpress_Creation_Kit::wck_generate_slug($slug_from . '_' . $value_attr)) . '" value="' . esc_attr($value_attr) . '"  ' . checked($found, true, false) . 'class="mb-checkbox mb-field" />' . esc_html($label) . '</label></div>';
    }
    $element .= '</div>';
}
 /**
  * Function that saves the entries for single forms on posts(no options). It is hooke on the 'save_post' hook
  * It is executed on each WCK object instance so we need to restrict it on only the ones that are present for that post
  */
 function wck_save_single_metabox($post_id, $post)
 {
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return $post_id;
     }
     // check permissions
     if (!current_user_can('edit_page', $post_id)) {
         return $post_id;
     }
     /* only go through for metaboxes defined for this post type */
     if (get_post_type($post_id) != $this->args['post_type']) {
         return $post_id;
     }
     if (!empty($_POST)) {
         /* for single metaboxes we save a hidden input that contains the meta_name attr as a key so we need to search for it */
         foreach ($_POST as $request_key => $request_value) {
             if (strpos($request_key, '_wckmetaname_') !== false && strpos($request_key, '#wck') !== false) {
                 /* found it so now retrieve the meta_name from the key formatted _wckmetaname_actuaname#wck */
                 $request_key = str_replace('_wckmetaname_', '', $request_key);
                 $meta_name = str_replace('#wck', '', $request_key);
                 /* we have it so go through only on the WCK object instance that has this meta_name */
                 if ($this->args['meta_name'] == $meta_name) {
                     /* get the meta values from the $_POST and store them in an array */
                     $meta_values = array();
                     if (!empty($this->args['meta_array'])) {
                         foreach ($this->args['meta_array'] as $meta_field) {
                             /* in the $_POST the names for the fields are prefixed with the meta_name for the single metaboxes in case there are multiple metaboxes that contain fields wit hthe same name */
                             $single_field_name = $this->args['meta_name'] . '_' . Wordpress_Creation_Kit::wck_generate_slug($meta_field['title'], $meta_field);
                             if (isset($_POST[$single_field_name])) {
                                 /* checkbox needs to be stored as string not array */
                                 if ($meta_field['type'] == 'checkbox') {
                                     $_POST[$single_field_name] = implode(', ', $_POST[$single_field_name]);
                                 }
                                 $meta_values[Wordpress_Creation_Kit::wck_generate_slug($meta_field['title'], $meta_field)] = $_POST[$single_field_name];
                             } else {
                                 $meta_values[Wordpress_Creation_Kit::wck_generate_slug($meta_field['title'], $meta_field)] = '';
                             }
                         }
                     }
                     /* test if we have errors for the required fields */
                     $errors = self::wck_test_required($this->args['meta_array'], $meta_name, $meta_values, $post_id);
                     if (!empty($errors)) {
                         /* if we have errors then add them in the global. We do this so we get all errors from all single metaboxes that might be on that page */
                         global $wck_single_forms_errors;
                         global $wck_single_forms_posted_values;
                         if (!empty($errors['errorfields'])) {
                             foreach ($errors['errorfields'] as $key => $field_name) {
                                 $errors['errorfields'][$key] = $this->args['meta_name'] . '_' . $field_name;
                             }
                         }
                         $wck_single_forms_errors[] = $errors;
                         $wck_single_forms_posted_values[$meta_name] = $meta_values;
                     } else {
                         do_action('wck_before_add_meta', $meta_name, $post_id, $meta_values);
                         do_action('wck_before_update_meta', $meta_name, $post_id, $meta_values, '0');
                         /* no errors so we can save */
                         update_post_meta($post_id, $meta_name, array($meta_values));
                         /* handle unserialized fields */
                         if ($this->args['unserialize_fields']) {
                             if (!empty($this->args['meta_array'])) {
                                 foreach ($this->args['meta_array'] as $meta_field) {
                                     update_post_meta($post_id, $meta_name . '_' . Wordpress_Creation_Kit::wck_generate_slug($meta_field['title'], $meta_field) . '_1', $_POST[$this->args['meta_name'] . '_' . Wordpress_Creation_Kit::wck_generate_slug($meta_field['title'], $meta_field)]);
                                 }
                             }
                         }
                     }
                     break;
                 }
             }
         }
     }
 }
Пример #6
0
 /**
  * AJAX Function that ads the post
  *
  * @since 1.0.0		
  */
 function wck_fep_add_post()
 {
     check_ajax_referer('wck-fep-add-post');
     $meta = $_POST['meta'];
     $post_ID = $_POST['postid'];
     if (!empty($_POST['values'])) {
         $values = $_POST['values'];
     } else {
         $values = array();
     }
     $single_cfcs = !empty($_POST['single_cfcs']) ? $_POST['single_cfcs'] : array();
     $action_type = $_POST['action_type'];
     /* check required fields */
     $errors = array();
     /* check required fields of single cfcs */
     if (!empty($single_cfcs)) {
         foreach ($single_cfcs as $meta_name => $single_values) {
             /* check required fields */
             $errors[$meta_name] = self::wck_test_required($this->single_cfcs[$meta_name], $meta_name, $single_values, 0);
         }
     }
     /* check required fields for default post fields */
     $errors[$meta] = self::wck_test_required($this->args['meta_array'], $meta, $values, 0);
     /* combine the errors from the default fields with single cfcs */
     $errors_json = array('error' => '', 'errorfields' => array());
     if (!empty($errors)) {
         foreach ($errors as $error) {
             if (!empty($error)) {
                 $errors_json['error'] .= $error['error'];
                 $errors_json['errorfields'] = array_merge($errors_json['errorfields'], $error['errorfields']);
             }
         }
     }
     if (!empty($errors_json['error'])) {
         header('Content-type: application/json');
         die(json_encode($errors_json));
     }
     /* if any single cfcs update the post meta */
     if (!empty($single_cfcs)) {
         foreach ($single_cfcs as $meta_name => $single_values) {
             update_post_meta($post_ID, $meta_name, array($single_values));
             /* if unserialize_fields is true add for each entry separate post meta for every element of the form  */
             if ($this->single_cfcs[$meta_name . '_unserialize_fields']) {
                 $meta_suffix = 1;
                 if (!empty($single_values)) {
                     foreach ($single_values as $name => $value) {
                         update_post_meta($post_ID, $meta_name . '_' . $name . '_' . $meta_suffix, $value);
                     }
                 }
             }
         }
     }
     /* treat empty keys in our $_POST values */
     $expected_keys = array('post-title', 'post-content', 'post-excerpt');
     foreach ($expected_keys as $expected_key) {
         if (!array_key_exists($expected_key, $values)) {
             $values[$expected_key] = '';
         }
     }
     $wck_fep_new_post = array('ID' => $post_ID, 'post_content' => $values['post-content'], 'post_excerpt' => $values['post-excerpt'], 'post_type' => $this->args['post_type']);
     if (!empty($values['post-title'])) {
         $wck_fep_new_post['post_title'] = wp_strip_all_tags($values['post-title']);
     } else {
         if (!empty($action_type) && $action_type == 'edit') {
             $wck_fep_new_post['post_title'] = get_the_title($post_ID);
         } else {
             $wck_fep_new_post['post_title'] = '';
         }
     }
     if (!empty($values['post-content'])) {
         $wck_fep_new_post['post_content'] = wp_strip_all_tags($values['post-content']);
     } else {
         if (!empty($action_type) && $action_type == 'edit') {
             $post_obj = get_post($post_ID);
             $wck_fep_new_post['post_content'] = $post_obj->post_content;
         } else {
             $wck_fep_new_post['post_content'] = '';
         }
     }
     if (!empty($values['post-excerpt'])) {
         $wck_fep_new_post['post_excerpt'] = wp_strip_all_tags($values['post-excerpt']);
     } else {
         if (!empty($action_type) && $action_type == 'edit') {
             $post_obj = get_post($post_ID);
             $wck_fep_new_post['post_excerpt'] = $post_obj->post_excerpt;
         } else {
             $wck_fep_new_post['post_excerpt'] = '';
         }
     }
     /* post status */
     if ($this->args['admin_approval'] == 'yes') {
         $wck_fep_new_post['post_status'] = 'draft';
     } else {
         $wck_fep_new_post['post_status'] = 'publish';
     }
     /* post author */
     if ($this->args['anonymous_posting'] == 'yes') {
         $wck_fep_new_post['post_author'] = $this->args['assign_to_user'];
     } else {
         $wck_fep_new_post['post_author'] = get_current_user_id();
     }
     if (!empty($values['featured-image'])) {
         set_post_thumbnail($post_ID, $values['featured-image']);
     }
     /* set comments status of the posts according to the default comment status */
     $comments_status = get_option('default_comment_status');
     if (empty($comments_status)) {
         $comments_status = 'closed';
     }
     $wck_fep_new_post['comment_status'] = $comments_status;
     // Insert the post into the database
     $post_id = wp_insert_post($wck_fep_new_post);
     /* take care of taxonomies */
     if (!empty($this->args['taxonomies'])) {
         foreach ($this->args['taxonomies'] as $taxonomy) {
             $tax_names = $values[Wordpress_Creation_Kit::wck_generate_slug($taxonomy->label)];
             if (!empty($tax_names)) {
                 $tax_names = explode(',', $tax_names);
                 /* strip white spaces */
                 if (!empty($tax_names)) {
                     foreach ($tax_names as $key => $tax_name) {
                         $tax_names[$key] = trim($tax_name);
                     }
                 }
                 /* get term ids by name and build the terms array */
                 $terms = array();
                 if (!empty($tax_names)) {
                     foreach ($tax_names as $tax_name) {
                         $idObj = get_term_by('name', htmlspecialchars($tax_name), $taxonomy->name);
                         if ($idObj != false) {
                             $terms[] = $idObj->term_id;
                         } else {
                             /* we don't have the term so create it ( for non hierarhical taxonomies ) */
                             $insert = wp_insert_term($tax_name, $taxonomy->name);
                             if (is_wp_error($insert)) {
                                 $error_string = $insert->get_error_message();
                                 echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
                             } else {
                                 $terms[] = $insert['term_id'];
                             }
                         }
                     }
                 }
                 if (!empty($terms)) {
                     //to make sure the terms IDs are integers:
                     $terms = array_map('intval', $terms);
                     $terms = array_unique($terms);
                     $set_result = wp_set_object_terms(intval($post_ID), $terms, $taxonomy->name);
                 }
             }
         }
     }
     if ($action_type == '') {
         do_action('wck_fep_add_post', $wck_fep_new_post, get_current_user_id());
     } else {
         if ($action_type == 'edit') {
             do_action('wck_fep_update_post', $wck_fep_new_post, get_current_user_id());
         }
     }
     if ($action_type == '') {
         echo apply_filters('wck_fep_post_added_message', __('Post Added', 'wck'), $meta);
     } else {
         if ($action_type == 'edit') {
             echo apply_filters('wck_fep_post_updated_message', __('Post Updated', 'wck'), $meta);
         }
     }
     die;
 }
Пример #7
0
if (!empty($details['options'])) {
    $element .= '<div class="wck-radiobuttons">';
    foreach ($details['options'] as $option) {
        $found = false;
        $values = explode(', ', $value);
        if (strpos($option, '%') === false) {
            $label = $option;
            $value_attr = $option;
            if (in_array($option, $values)) {
                $found = true;
            }
        } else {
            $option_parts = explode('%', $option);
            if (!empty($option_parts)) {
                if (empty($option_parts[0]) && count($option_parts) == 3) {
                    $label = $option_parts[1];
                    $value_attr = $option_parts[2];
                    if (in_array($option_parts[2], $values)) {
                        $found = true;
                    }
                }
            }
        }
        $element .= '<div><label><input type="radio" name="' . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'])) . '" id="';
        if (!empty($frontend_prefix)) {
            $element .= $frontend_prefix;
        }
        $element .= esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'] . '_' . $value_attr)) . '" value="' . esc_attr($value_attr) . '"  ' . checked($found, true, false) . 'class="mb-radio mb-field" />' . esc_html($label) . '</label></div>';
    }
    $element .= '</div>';
}
Пример #8
0
<?php

/* @param string $meta Meta name.	 
 * @param array $details Contains the details for the field.	 
 * @param string $value Contains input value;
 * @param string $context Context where the function is used. Depending on it some actions are preformed.;
 * @return string $element input element html string. */
$random_id = "wck_wisi_editor_" . time() . '-' . rand();
$element .= '<textarea name="' . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'])) . '" class="mb-textarea mb-field ' . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'])) . '" id="' . $random_id . '">' . esc_html($value) . '</textarea>';
$element .= '<script type="text/javascript">jQuery( function(){	
		CKEDITOR.replace("' . $random_id . '");
	});</script>';
?>

Пример #9
0
$options = '';
if (!empty($details['options'])) {
    $i = 0;
    foreach ($details['options'] as $option) {
        if (strpos($option, '%') === false) {
            $label = $option;
            if (!empty($details['values'])) {
                $value_attr = $details['values'][$i];
            } else {
                $value_attr = $option;
            }
        } else {
            $option_parts = explode('%', $option);
            if (!empty($option_parts)) {
                if (empty($option_parts[0]) && count($option_parts) == 3) {
                    $label = $option_parts[1];
                    if (!empty($details['values'])) {
                        $value_attr = $details['values'][$i];
                    } else {
                        $value_attr = $option_parts[2];
                    }
                }
            }
        }
        $options .= '<option value="' . esc_attr($value_attr) . '"  ' . selected($value_attr, $value, false) . ' >' . esc_html($label) . '</option>';
        $i++;
    }
}
$field_name = Wordpress_Creation_Kit::wck_generate_slug($details['title']);
$element .= apply_filters("wck_select_{$meta}_{$field_name}_options", $options);
$element .= '</select>';
<?php

/* @param string $meta Meta name.	 
 * @param array $details Contains the details for the field.	 
 * @param string $value Contains input value;
 * @param string $context Context where the function is used. Depending on it some actions are preformed.;
 * @return string $element input element html string. */
$args = apply_filters('wck-user-select-args', array('orderby' => 'display_name'));
$user_query = new WP_User_Query($args);
if (!empty($user_query->results)) {
    $element .= '<select name="' . $single_prefix . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details)) . '"  id="';
    if (!empty($frontend_prefix)) {
        $element .= $frontend_prefix;
    }
    $element .= esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details)) . '" class="mb-user-select mb-field" >';
    $element .= '<option value="">' . __('...Choose', 'wck') . '</option>';
    foreach ($user_query->results as $user) {
        $element .= '<option value="' . esc_attr($user->ID) . '"  ' . selected($user->ID, $value, false) . ' >' . esc_html($user->display_name) . '</option>';
    }
    $element .= '</select>';
}
Пример #11
0
        $element .= '<div id="' . esc_attr($upload_info_div_id) . '_info_container" class="upload-field-details" data-attachment_id="' . $value . '">';
        $element .= '<div class="file-thumb">';
        $element .= "<a href='{$attachment_url}' target='_blank' class='wck-attachment-link'>" . $thumbnail . "</a>";
        $element .= '</div>';
        $element .= '<p><span class="file-name">';
        $element .= $file_name;
        $element .= '</span><span class="file-type">';
        $element .= $file_type;
        $element .= '</span>';
        if (!empty($value)) {
            $element .= '<span class="wck-remove-upload">' . __('Remove', 'core') . '</span>';
        }
        $element .= '</p></div>';
    }
}
$element .= '<a href="#" class="button wck_upload_button" id="upload_' . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details)) . '_button" data-uploader_title="' . $details['title'] . '" data-uploader_button_text="Select Files" data-upload_input="' . esc_attr($upload_input_id) . '" ';
if (is_user_logged_in()) {
    $element .= 'data-uploader_logged_in="true"';
}
if (!empty($post_id)) {
    $element .= ' data-post_id="' . $post_id . '"';
}
if (!empty($details['multiple_upload'])) {
    if ($details['multiple_upload'] == 'true') {
        $element .= ' data-multiple_upload="true"';
    } else {
        $element .= ' data-multiple_upload="false"';
    }
}
if (!empty($details['attach_to_post'])) {
    if ($details['attach_to_post'] == true) {
Пример #12
0
<?php

/* @param string $meta Meta name.	 
 * @param array $details Contains the details for the field.	 
 * @param string $value Contains input value;
 * @param string $context Context where the function is used. Depending on it some actions are preformed.;
 * @return string $element input element html string. */
$element .= '<input type="text" name="' . $single_prefix . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details)) . '" id="';
if (!empty($frontend_prefix)) {
    $element .= $frontend_prefix;
}
$element .= esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details)) . '"';
if (!empty($details['readonly']) && $details['readonly']) {
    $element .= 'readonly="readonly"';
}
$element .= ' value="' . esc_attr($value) . '" class="mb-text-input mb-field"/>';
 function wck_test_required($meta_array, $meta, $values, $id)
 {
     $fields = $meta_array;
     $required_fields = array();
     $required_fields_with_errors = array();
     $required_message = '';
     $errors = '';
     if (!empty($fields)) {
         foreach ($fields as $field) {
             if (!empty($field['required']) && $field['required']) {
                 $required_fields[Wordpress_Creation_Kit::wck_generate_slug($field['title'])] = $field['title'];
             }
         }
     }
     if (!empty($values)) {
         foreach ($values as $key => $value) {
             if (array_key_exists($key, $required_fields) && apply_filters("wck_required_test_{$meta}_{$key}", empty($value), $value, $id)) {
                 $required_message .= apply_filters("wck_required_message_{$meta}_{$key}", __("Please enter a value for the required field ", "wck") . "{$required_fields[$key]} \n", $value);
                 $required_fields_with_errors[] = $key;
             }
         }
     }
     $required_message .= apply_filters("wck_extra_message", "", $fields, $required_fields, $meta, $values, $id);
     $required_fields_with_errors = apply_filters("wck_required_fields_with_errors", $required_fields_with_errors, $fields, $required_fields, $meta, $values, $id);
     if ($required_message != '') {
         $errors = array('error' => $required_message, 'errorfields' => $required_fields_with_errors);
     }
     return $errors;
 }
function wck_opc_change_option_page_arg($meta, $id, $values, $element_id)
{
    global $wpdb;
    if ($meta == 'wck_opc_args') {
        $wck_opc_args = get_post_meta($id, 'wck_opc_args', true);
        if (!empty($wck_opc_args)) {
            if ($wck_opc_args[$element_id]['page-name-in-menu'] != $values['page-name-in-menu']) {
                /* Get all Option Fields */
                $args = array('post_type' => 'wck-option-field', 'numberposts' => -1);
                $all_option_fields = get_posts($args);
                if (!empty($all_option_fields)) {
                    foreach ($all_option_fields as $all_option_field) {
                        $option_field_args = get_post_meta($all_option_field->ID, 'wck_opc_field_args', true);
                        if (!empty($option_field_args)) {
                            if ($option_field_args[0]['option-page'] == Wordpress_Creation_Kit::wck_generate_slug($wck_opc_args[$element_id]['page-name-in-menu'])) {
                                $option_field_args[0]['option-page'] = Wordpress_Creation_Kit::wck_generate_slug($values['page-name-in-menu']);
                                update_post_meta($all_option_field->ID, 'wck_opc_field_args', $option_field_args);
                            }
                        }
                    }
                }
            }
        }
    }
}
function wck_stp_custom_columns($column_name, $post_id)
{
    if ($column_name == 'stp-shortcode') {
        $post = get_post($post_id);
        if (empty($post->post_title)) {
            $post->post_title = '(no title)';
        }
        echo '<strong>[swift-template name="' . Wordpress_Creation_Kit::wck_generate_slug($post->post_title) . '"]</strong>';
    }
}
<?php

/* @param string $meta Meta name.	 
 * @param array $details Contains the details for the field.	 
 * @param string $value Contains input value;
 * @param string $context Context where the function is used. Depending on it some actions are preformed.;
 * @return string $element input element html string. */
$element .= '<input type="text" name="' . $single_prefix . esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details)) . '" id="';
if (!empty($frontend_prefix)) {
    $element .= $frontend_prefix;
}
$element .= esc_attr(Wordpress_Creation_Kit::wck_generate_slug($details['title'], $details)) . '" value="' . esc_attr($value) . '" class="mb-datepicker mb-field"/>';
$element .= '<script type="text/javascript">jQuery( function(){jQuery(".mb-datepicker").datepicker({' . apply_filters('wck-datepicker-args', 'dateFormat : "dd-mm-yy",changeMonth: true,changeYear: true') . '})});</script>';