function layers_demo_meta_box_callback($post) { // Add an nonce field so we can check for it later. wp_nonce_field('layers_demo_meta_box', 'layers_demo_meta_box_nonce'); /* * Use get_post_meta() to retrieve an existing value * from the database and use the value for the form. */ $credit_name = get_post_meta($post->ID, 'my_photo_credit', true); $credit_url = get_post_meta($post->ID, 'my_credit_url', true); // form elements go here if (class_exists('Layers_Form_Elements')) { $form_elements = new Layers_Form_Elements(); //Photo Source echo '<p class="layers-form-item">'; echo '<label>' . __('Photo Source', 'layerswp') . '</label> '; echo $form_elements->input(array('type' => 'text', 'name' => 'my_photo_credit', 'id' => 'my_photo_credit', 'placeholder' => __('Photo Source', 'layerswp'), 'value' => isset($credit_name) ? $credit_name : '', 'class' => 'layers-text')); echo '</p>'; // Photo Source URL echo '<p class="layers-form-item">'; echo '<label>' . __('Photo Source URL', 'layerswp') . '</label> '; echo $form_elements->input(array('type' => 'text', 'name' => 'my_credit_url', 'id' => 'my_credit_url', 'placeholder' => __('Photo Credit URL', 'layerswp'), 'value' => isset($credit_url) ? $credit_url : '', 'class' => 'layers-text')); echo '</p>'; $photo_description = get_post_meta($post->ID, 'my_photo_desc', true); /* Add WP Editor as replacement of textarea */ echo '<p class="layers-form-item">'; echo '<label>' . __('Photo Description', 'layerswp') . '</label> '; wp_editor($photo_description, 'my_photo_desc', array('wpautop' => true, 'media_buttons' => false, 'textarea_name' => 'my_photo_desc', 'textarea_rows' => 10, 'teeny' => true)); echo '</p>'; } // If Class exists }
public function render_content() { $form_elements = new Layers_Form_Elements(); ?> <div id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="layers-customize-control layers-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> <?php echo esc_attr($this->class); ?> " <?php echo $this->get_linked_data(); ?> > <span class="customize-control-title"> <?php echo esc_html($this->label); ?> </span> <div class="layers-form-item"> <?php if ('' != $this->subtitle) { ?> <label class="layers-form-row"><?php echo $this->subtitle; ?> </label> <?php } ?> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo $this->description; ?> </div> <?php } ?> <div class="layers-form-item"> <?php echo $form_elements->input(array('type' => 'color', 'name' => '', 'id' => $this->id, 'value' => $this->value(), 'data' => $this->get_customize_data())); ?> </div> </div> </div> <?php }
public function render_content() { $form_elements = new Layers_Form_Elements(); $values = false; ?> <div id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="layers-customize-control layers-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> <?php echo esc_attr($this->class); ?> " <?php echo $this->get_linked_data(); ?> > <?php $this->render_history_actions(); ?> <?php if ('' != $this->heading_divider) { ?> <?php $this->render_heading_divider($this->heading_divider); ?> <?php } ?> <div class="layers-form-item"> <div class="layers-checkbox-wrapper layers-form-item"> <?php echo $form_elements->input(array('type' => 'checkbox', 'label' => $this->label, 'name' => '', 'id' => $this->id, 'data' => $this->get_customize_data())); ?> </div> </div> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo $this->description; ?> </div> <?php } ?> </div> <?php }
public function render_content() { // Exit if there are no choises if (empty($this->choices)) { return; } $form_elements = new Layers_Form_Elements(); $values = false; ?> <div id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="layers-customize-control layers-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> <?php echo esc_attr($this->class); ?> " <?php echo $this->get_linked_data(); ?> > <span class="customize-control-title"> <?php echo esc_html($this->label); ?> </span> <div class="layers-form-item"> <?php if ('' != $this->subtitle) { ?> <label class="layers-form-row"><?php echo $this->subtitle; ?> </label> <?php } ?> <div class="layers-font-wrapper layers-form-item"> <?php echo $form_elements->input(array('type' => 'select', 'label' => isset($this->label) ? $this->label : '', 'name' => '', 'id' => $this->id, 'options' => $this->choices, 'data' => $this->get_customize_data())); ?> </div> </div> <div class="description customize-control-description" data-base-url="https://www.google.com/fonts/specimen/"> <?php echo sprintf(__('<em>Click <a href="%1s" target="_blank">here</a> to see this font on Google Fonts.</em>', 'layerswp'), 'https://www.google.com/fonts/specimen/' . $this->value()); ?> </div> </div> <?php }
public function render_content() { $form_elements = new Layers_Form_Elements(); $values = false; ?> <div id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="layers-customize-control layers-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> " <?php echo $this->get_linked_data(); ?> > <span class="customize-control-title"> <?php echo esc_html($this->label); ?> </span> <div class="layers-form-item"> <?php if ('' != $this->subtitle) { ?> <label class="layers-form-row"><?php echo $this->subtitle; ?> </label> <?php } ?> <?php echo $form_elements->input(array('type' => 'image', 'label' => __('Choose Background', 'layerswp'), 'name' => '', 'id' => $this->id, 'value' => isset($values['background']['image']) ? $values['background']['image'] : $this->value(), 'data' => $this->get_customize_data())); ?> </div> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo esc_html($this->description); ?> </div> <?php } ?> </div> <?php }
public function render_content() { $form_elements = new Layers_Form_Elements(); $values = false; ?> <div id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="layers-customize-control layers-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> <?php echo esc_attr($this->class); ?> " <?php echo $this->get_linked_data(); ?> > <span class="customize-control-title"> <?php echo esc_html($this->label); ?> </span> <div class="layers-form-item"> <div class="<?php echo esc_attr($this->id); ?> -wrapper layers-form-item"> <?php echo $form_elements->input(array('type' => 'button', 'label' => $this->text, 'id' => $this->id, 'tag' => 'a', 'href' => $this->href)); ?> </div> </div> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo $this->description; ?> </div> <?php } ?> </div> <?php }
public function render_content() { $form_elements = new Layers_Form_Elements(); $values = false; ?> <div data-test id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="layers-customize-control layers-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> <?php echo esc_attr($this->class); ?> " <?php echo $this->get_linked_data(); ?> > <?php $this->render_history_actions(); ?> <?php if ('' != $this->heading_divider) { ?> <?php $this->render_heading_divider($this->heading_divider); ?> <?php } ?> <?php if ('' != $this->label) { ?> <span class="customize-control-title"><?php echo $this->label; ?> </span> <?php } ?> <div class="layers-form-item"> <?php if ('' != $this->subtitle) { ?> <label class="layers-form-row"><?php echo $this->subtitle; ?> </label> <?php } ?> <div class="layers-form-item <?php echo $this->colspan ? esc_attr("layers-column-flush layers-span-{$this->colspan}") : ''; ?> "> <?php echo $form_elements->input(array('type' => 'number', 'label' => isset($this->label) ? $this->label : '', 'name' => '', 'id' => $this->id, 'value' => stripslashes($this->value()), 'data' => $this->get_customize_data())); ?> </div> </div> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo $this->description; ?> </div> <?php } ?> </div> <?php }
public function render_content() { $form_elements = new Layers_Form_Elements(); $values = false; ?> <div id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="l_option-customize-control l_option-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> <?php echo esc_attr($this->class); ?> " <?php echo $this->get_linked_data(); ?> > <?php $this->render_history_actions(); ?> <?php if ('' != $this->heading_divider) { ?> <?php $this->render_heading_divider($this->heading_divider); ?> <?php } ?> <?php if ('' != $this->label) { ?> <span class="customize-control-title"><?php echo $this->label; ?> </span> <?php } ?> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo $this->description; ?> </div> <?php } ?> <?php if ('' != $this->subtitle) { ?> <label class="layers-form-row"><?php echo $this->subtitle; ?> </label> <?php } ?> <div class="layers-form-item <?php echo $this->colspan ? esc_attr("layers-column-flush layers-span-{$this->colspan}") : ''; ?> "> <?php echo $form_elements->input(array('type' => 'trbl-fields', 'name' => '', 'id' => $this->id, 'value' => array('top' => get_option("{$this->id}-top"), 'right' => get_option("{$this->id}-right"), 'bottom' => get_option("{$this->id}-bottom"), 'left' => get_option("{$this->id}-left")), 'fields' => $this->fields)); ?> </div> </div> <?php }
/** * Custom Meta Interface */ public function display_post_meta($post, $callback_args) { // Get post type $post_type = get_post_type($post->ID); // Post Meta Value $post_meta = get_post_meta($post->ID, LAYERS_THEME_SLUG, true); // Set the meta index ie. the array we will loop over for our options $meta_index = $callback_args['args']['meta_index']; // If there is no post meta to show, return if (!isset($this->custom_meta[$meta_index])) { return; } // Instantiate form elements $form_elements = new Layers_Form_Elements(); // If there is Post Meta, loop over the tabs. if (isset($this->custom_meta[$meta_index])) { ?> <!-- Tabs --> <div class="l_admin-nav l_admin-nav-tabs"> <ul class="l_admin-tabs clearfix"> <?php foreach ($this->custom_meta[$meta_index]['custom-meta'] as $key => $meta_option) { ?> <li <?php if (!isset($inactive)) { echo 'class="active"'; } ?> ><a href="#"><?php echo $meta_option['title']; ?> </a></li> <?php $inactive = 1; ?> <?php } // foreach $this->custom_meta[ $post_type ]['custom-meta'] ?> </ul> </div> <!-- Tab Content --> <div class="l_admin-tab-content"> <?php foreach ($this->custom_meta[$meta_index]['custom-meta'] as $key => $meta_option) { ?> <section class="l_admin-accordion-section l_admin-content l_admin-tab-content <?php if (isset($hide_tab)) { echo 'l_admin-hide'; } ?> customize-control"> <?php // @TODO: Remove .customizer-control class ?> <div class="l_admin-row clearfix"> <?php if (isset($meta_option['elements'])) { ?> <fieldset> <?php foreach ($meta_option['elements'] as $input_key => $input) { ?> <p class="l_admin-form-item"> <label><?php echo $input['label']; ?> </label> <?php echo $form_elements->input(array('type' => $input['type'], 'name' => LAYERS_THEME_SLUG . '[' . $input_key . ']', 'id' => $input_key, 'default' => isset($input['default']) ? $input['default'] : NULL, 'placeholder' => isset($input['placeholder']) ? $input['placeholder'] : NULL, 'value' => isset($post_meta[$input_key]) ? $post_meta[$input_key] : (isset($input['default']) ? $input['default'] : NULL), 'options' => isset($input['options']) ? $input['options'] : NULL, 'class' => 'layers-' . $input['type'])); ?> </p> <?php } // foreach $meta_option[ 'elements' ] ?> </fieldset> <?php } // if $meta_option[ 'elements' ] ?> </div> </section> <?php $hide_tab = 1; ?> <?php } // foreach $this->custom_meta[ $post_type ]['custom-meta'] ?> </div> <?php wp_nonce_field(LAYERS_THEME_SLUG . '-post-meta', '_wp_nonce_' . LAYERS_THEME_SLUG); ?> <?php } // if $this->custom_meta[ $post_type ] ?> <?php }
</div> </section> <section class="l_admin-modal-container l_admin-hide"> <div class="l_admin-vertical-center l_admin-modal"> <div class="l_admin-section-title l_admin-no-push-bottom"> <h2 class="l_admin-heading l_admin-push-bottom" id="layers-options-header"> <?php _e('Add a page title', 'layerswp'); ?> </h2> <p class="l_admin-form-item"> <?php echo $form_elements->input(array('type' => 'text', 'name' => 'layers_preset_page_title', 'id' => 'layers_preset_page_title', 'placeholder' => __('Enter title here', 'layerswp'), 'value' => NULL, 'class' => 'layers-text l_admin-large')); ?> </p> <p id="layers-preset-layout-next-button"> <a id="layers-preset-proceed" href="" class="button button-primary btn-large" data-post_id="" data-location=""> <?php _e('Proceed to Customizer', 'layerswp'); ?> </a> <a id="layers-preset-cancel" href="" class="button btn-link btn-large pull-right"> <?php _e('Cancel', 'layerswp'); ?> </a>
<div class="layers-content-large"> <!-- Your content goes here --> <div class="layers-section-title"> <h3 class="layers-heading"> <?php _e('Layers Messenger', 'layerswp'); ?> </h3> <p class="layers-excerpt"> <?php _e('Enable the Layers Messenger to connect with the Layers team directly from inside Layers. We can help you make informed decisions about themes and extensions and point you in the right direction when you need support with your site and Layers.', 'layerswp'); ?> </p> </div> <?php echo $form_elements->input(array('type' => 'hidden', 'name' => 'action', 'id' => 'action', 'value' => 'layers_update_intercom')); ?> <div class="layers-checkbox-wrapper layers-form-item layers-push-bottom-medium"> <input id="layers-enable-intercom" name="layers_intercom" type="checkbox" <?php if ('0' !== get_option('layers_enable_intercom')) { echo 'checked="checked"'; } ?> /> <label for="layers-enable-intercom"><?php _e('Enable Layers Messenger', 'layerswp'); ?> </label> </div> <p data-show-if-selector="#layers-enable-intercom" data-show-if-value="true" class="layers-form-item"> <label><?php
?> </p> </div> <div class="l_admin-form-item"> <label> <?php _e('What is the name of your website?', 'layerswp'); ?> <i class="fa fa-question-circle" data-tip="<?php echo esc_attr(__('Enter your website name below. We'll use this in your site title and in search results.', 'layerswp')); ?> "></i> </label> <?php echo $form_elements->input(array('type' => 'text', 'name' => 'blogname', 'id' => 'blogname', 'placeholder' => get_bloginfo('name'), 'value' => get_bloginfo('name'), 'class' => 'layers-text l_admin-large')); ?> </div> <div class="l_admin-form-item"> <label> <?php _e('How would you describe your site?', 'layerswp'); ?> <i class="fa fa-question-circle" data-tip="<?php _e('A tagline describes who and what you are in just a few simple words. For example Layers is a “WordPress Site Builder” - simple, easy, quick to read. Now you try:', 'layerswp'); ?> "></i> </label> <?php echo $form_elements->input(array('type' => 'text', 'name' => 'blogdescription', 'id' => 'blogdescription', 'placeholder' => get_bloginfo('description'), 'value' => get_bloginfo('description'), 'class' => 'layers-text l_admin-large'));
public function render_content() { $form_elements = new Layers_Form_Elements(); $values = false; ?> <div data-test id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="layers-customize-control layers-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> <?php echo esc_attr($this->class); ?> " <?php echo $this->get_linked_data(); ?> > <span class="customize-control-title"> <?php echo esc_html($this->label); ?> </span> <div class="layers-form-item"> <?php if ('' != $this->subtitle) { ?> <label class="layers-form-row"><?php echo $this->subtitle; ?> </label> <?php } ?> <div class="layers-form-item"> <?php echo $form_elements->input(array('type' => 'range', 'label' => isset($this->label) ? $this->label : '', 'name' => '', 'id' => $this->id, 'value' => stripslashes($this->value()), 'data' => $this->get_customize_data(), 'min' => isset($this->min) ? $this->min : 0, 'max' => isset($this->max) ? $this->max : 100, 'step' => isset($this->step) ? $this->step : 1)); ?> </div> </div> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo $this->description; ?> </div> <?php } ?> </div> <?php }
public function render_content() { $form_elements = new Layers_Form_Elements(); $values = false; ?> <div id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="layers-customize-control layers-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> <?php echo esc_attr($this->class); ?> " <?php echo $this->get_linked_data(); ?> > <?php $this->render_history_actions(); ?> <?php if ('' != $this->heading_divider) { ?> <?php $this->render_heading_divider($this->heading_divider); ?> <?php } ?> <?php if ('' != $this->label) { ?> <span class="customize-control-title"><?php echo $this->label; ?> </span> <?php } ?> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo $this->description; ?> </div> <?php } ?> <div class="layers-code-wrapper layers-form-item"> <?php if ('' != $this->subtitle) { ?> <label class="layers-form-row"><?php echo $this->subtitle; ?> </label> <?php } ?> <?php echo $form_elements->input(array('type' => 'textarea', 'label' => $this->label, 'name' => '', 'id' => $this->id, 'data' => $this->get_customize_data(), 'placeholder' => $this->placeholder)); ?> </div> </div> <?php }
<?php } ?> </div> <?php } ?> <?php if (isset($setup_details['form'])) { ?> <?php foreach ($setup_details['form'] as $form_id => $form_details) { ?> <div class="layers-form-item"> <?php $form_elements->input($form_details); ?> </div> <?php } ?> <?php } ?> </div> <?php if (isset($setup_details['skip-action']) || isset($setup_details['submit-action'])) { ?> <div class="layers-button-well"> <?php if (isset($setup_details['skip-action'])) {
public function render_content() { // Exit if there are no choices if (empty($this->choices)) { return; } $form_elements = new Layers_Form_Elements(); $values = false; ?> <div id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="l_option-customize-control l_option-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> <?php echo esc_attr($this->class); ?> " <?php echo $this->get_linked_data(); ?> > <?php $this->render_history_actions(); ?> <?php if ('' != $this->heading_divider) { ?> <?php $this->render_heading_divider($this->heading_divider); ?> <?php } ?> <?php if ('' != $this->label) { ?> <span class="customize-control-title"><?php echo $this->label; ?> </span> <?php } ?> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo $this->description; ?> </div> <?php } ?> <?php if ('' != $this->subtitle) { ?> <label class="layers-form-row"><?php echo $this->subtitle; ?> </label> <?php } ?> <div class="layers-form-item layers-select-wrapper <?php echo $this->colspan ? esc_attr("layers-column-flush layers-span-{$this->colspan}") : ''; ?> "> <?php echo $form_elements->input(array('type' => 'select', 'label' => isset($this->label) ? $this->label : '', 'name' => '', 'id' => $this->id, 'options' => $this->choices, 'data' => $this->get_customize_data())); ?> </div> </div> <?php }
public function render_content() { // Exit if there are no choises if (empty($this->choices)) { return; } $form_elements = new Layers_Form_Elements(); $values = false; ?> <div data-test id="layers-customize-control-<?php echo esc_attr($this->id); ?> " class="layers-customize-control layers-customize-control-<?php echo esc_attr(str_replace('layers-', '', $this->type)); ?> " <?php echo $this->get_linked_data(); ?> > <span class="customize-control-title"> <?php echo esc_html($this->label); ?> </span> <div class="layers-form-item"> <?php if ('' != $this->subtitle) { ?> <label class="layers-form-row"><?php echo $this->subtitle; ?> </label> <?php } ?> <div class="layers-select-wrapper layers-form-item"> <?php echo $form_elements->input(array('type' => 'select', 'label' => isset($this->label) ? $this->label : '', 'name' => '', 'id' => $this->id, 'options' => $this->choices, 'data' => $this->get_customize_data())); ?> </div> </div> <?php if ('' != $this->description) { ?> <div class="description customize-control-description"> <?php echo esc_html($this->description); ?> </div> <?php } ?> </div> <?php }