HTML, PHP, Wordpress Job by deokib

i need only one code alternation in my function php file. i am attaching my function.php.

actually the work is i have created a custom meta box with 2 text field, one text area and one taxonomy (category field) in one meta box. i need this repeat (entire meta box) by a button clicking. this repeating is unlimited or capping in 30 block or so.

and need to display it dynamically on post


// Add the Meta Box


function add_custom_meta_box() {


'custom_meta_box', // $id

'Add Coureses', // $title

'show_custom_meta_box', // $callback

'post', // $page

'normal', // $context

'high', // $priority



add_action('add_meta_boxes', 'add_custom_meta_box');

// Field Array

$prefix = 'custom_';

$custom_meta_fields = array(


'label' => 'Course Name',

'desc' => 'A description for the field.',

'id' => $prefix.'text',

'type' => 'text'



'label' => 'Description',

'desc' => 'A description for the field.',

'id' => $prefix.'textarea',

'type' => 'textarea'



'label' => 'Course Category',

'id' => 'category',

'type' => 'tax_select'



// enqueue scripts and styles, but only if is_admin

if(is_admin()) {



wp_enqueue_script('custom-js', get_template_directory_uri().'/js/[url removed, login to view]');

wp_enqueue_style('jquery-ui-custom', get_template_directory_uri().'/css/[url removed, login to view]');


// add some custom js to the head of the page


function add_custom_scripts() {

global $custom_meta_fields, $post;

$output = '<script type="text/javascript">

jQuery(function() {';

foreach ($custom_meta_fields as $field) { // loop through the fields looking for certain types

// date

if($field['type'] == 'date')

$output .= 'jQuery(".datepicker").datepicker();';

// slider

if ($field['type'] == 'slider') {

$value = get_post_meta($post->ID, $field['id'], true);

if ($value == '') $value = $field['min'];

$output .= '

jQuery( "#'.$field['id'].'-slider" ).slider({

value: '.$value.',

min: '.$field['min'].',

max: '.$field['max'].',

step: '.$field['step'].',

slide: function( event, ui ) {

jQuery( "#'.$field['id'].'" ).val( [url removed, login to view] );





$output .= '});


echo $output;


// The Callback

function show_custom_meta_box() {

global $custom_meta_fields, $post;

// Use nonce for verification

echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';

// Begin the field table and loop

echo '<table class="form-table">';

foreach ($custom_meta_fields as $field) {

// get value of this field if it exists for this post

$meta = get_post_meta($post->ID, $field['id'], true);

// begin a table row with

echo '<tr>

<th><label for="'.$field['id'].'">'.$field['label'].'</label></th>


switch($field['type']) {

// text

case 'text':

echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />

<br /><span class="description">'.$field['desc'].'</span>';


// textarea

case 'textarea':

echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>

<br /><span class="description">'.$field['desc'].'</span>';


// tax_select

case 'tax_select':

echo '<select name="'.$field['id'].'" id="'.$field['id'].'">

<option value="">Select One</option>'; // Select One

$terms = get_terms($field['id'], 'get=all');

$selected = wp_get_object_terms($post->ID, $field['id']);

foreach ($terms as $term) {

if (!empty($s

Kemahiran: HTML, PHP, Wordpress

Lihat lebih lanjut: row 44, prefix function, val , taxonomy, meta slider, custom post type, input verification code, jquery css slide, project input output, css jquery slide, code block project, javascript callback, php text array, jquery callback, custom function php, textarea jquery php, javascript slide box, javascript input value event, jquery css slider, css table custom, custom block, slider hidden, javascript array post, php post array, table css add

Tentang Majikan:
( 0 ulasan ) Cochin, India

ID Projek: #4109860

1 pekerja bebas membida secara purata $30 untuk pekerjaan ini


Hired by the Employer

$30 USD dalam sehari
(49 Ulasan)