Пример #1
0
function caviar_meta_box2_callback($post)
{
    wp_nonce_field('caviar_save_meta_box2_data', 'caviar_meta_box2_nonce');
    $txtDetail = get_post_meta($post->ID, '_txtDetail', true);
    $txtArea = get_post_meta($post->ID, '_txtArea', true);
    $fieldy = array('scenery' => array('id' => 'sceneTitle', 'title' => 'Scenery', 'type' => 'text'), 'pic' => array('id' => 'scenePic', 'title' => 'Scene Pic', 'type' => 'upload'));
    $fieldControl = new Field_Controls();
    $fieldControl->upload('Featured', 'upFeatured', array('name' => 'upFeatured', 'value' => $upPhoto, 'class' => 'single previewImage', 'placeholder' => esc_html__('Featured URL', 'claypress')));
    $fieldControl->editor('Detail', 'txtDetail', array('value' => esc_attr($txtDetail)));
    $fieldControl->editor('Area', 'txtArea', array('value' => esc_attr($txtArea)));
    $fieldControl->repeaterField('Scene', 'reScene', array('name' => 'reScene', 'value' => $reScene), $fieldy);
}
Пример #2
0
            $control_type = self::must_exists($type, "type='{$type}'", "type='text'");
            $control_value = self::must_exists($value, "value='{$value}'", '');
            $control_placeholder = self::must_exists($placeholder, "placeholder='{$placeholder}'", '');
            $control_label = self::must_exists($title, "<label class='control-label  main-label' for='{$id}'>{$title}</label>", '');
            $control_info = self::must_exists($info, "<span class='control-info'>{$info}</span>", '');
            $before_control = self::must_exists($before_control, $before_control, "<div class='widget-separator'>");
            $after_control = self::must_exists($after_control, $after_control, "</div>");
            /* Print markup before control*/
            echo $before_control;
            /* Print label before control */
            echo $control_label;
            wp_enqueue_style('jquery-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css');
            echo "<div id='caviar-" . $id . "' class='repeater-field dynamicAccordion-" . $id . "' data-id='" . $id . "' data-name='" . $name . "' data-fields='" . json_encode($fields) . "' data-fields-count='" . count($value) . "'>";
            echo self::each_repeater($title, $id, $name, $value, $fields) . '<div class="widget-separator"> <span id="' . $id . '-clone"></span> </div>';
            echo "</div>";
            echo "<div class='formRowRepeatingSection'>\n\t \t\t\t<a href='#' class='button button-primary button-large addField'>" . esc_html__('Add Field', 'caviar') . "</a>\n\t \t\t</div>";
            /* Print control info text */
            echo $control_info;
            /* Print markup after control*/
            echo $after_control;
            // /* Echo field or return the markup */
            // if( $echo === false){
            // 	return $input;
            // }
            // else {
            // 	echo $input;
            // }
        }
    }
    Field_Controls::getInstance();
}