function _jc_mb_landing_grid() { rbm_do_field_select('columns', 'Columns', false, array('options' => array(1 => '1', 2 => '2', 3 => '3', 4 => '4'), 'input_class' => '')); $pages = get_posts(array('post_type' => 'page', 'numberposts' => -1)); $options = array(0 => '- Select a Page -'); if ($pages) { foreach ($pages as $page) { $options[$page->ID] = get_the_title($page); } } rbm_do_field_repeater('landing_grid', 'Grid Items', array('title' => array('type' => 'text', 'label' => 'Title'), 'text' => array('type' => 'text', 'label' => 'Text'), 'color' => array('type' => 'colorpicker', 'label' => 'Color'), 'image' => array('type' => 'image', 'label' => 'Background Image'), 'link' => array('type' => 'select', 'label' => 'Page Link', 'args' => array('options' => $options, 'input_class' => 'rbm-select2')))); }
function jc_mb_post_publish_box() { echo '<div class="misc-pub-section">'; echo 'Show on Home Page: '; switch ($hidden = rbm_get_field('hidden_on_home')) { case false: case '0': echo '<span class="dashicons dashicons-visibility"></span>'; break; case '1': echo '<span class="dashicons dashicons-hidden"></span>'; break; } rbm_do_field_select('hidden_on_home', false, $hidden, array('options' => array('0' => 'Show', '1' => 'Hide'))); echo '</div>'; }
function _jc_mb_post_publish_box() { echo '<div class="misc-pub-section">'; echo 'Featured: '; switch (rbm_get_field('featured')) { case false: case 'not_featured': echo '<span class="dashicons dashicons-star-empty"></span>'; break; case 'primary_featured': echo '<span class="dashicons dashicons-star-filled"></span>'; break; case 'sub_featured': echo '<span class="dashicons dashicons-star-half"></span>'; break; } rbm_do_field_select('featured', false, false, array('options' => array('not_featured' => 'Not Featured', 'primary_featured' => 'Primary Featured', 'sub_featured' => 'Secondary Featured'))); echo '</div>'; }
function _mb_courses() { $courses = get_posts(array('post_type' => 'jcaca-course', 'numberposts' => -1)); $select_options = !empty($courses) ? wp_list_pluck($courses, 'post_title', 'ID') : array(); rbm_do_field_select('courses', false, false, array('options' => $select_options, 'multiple' => true, 'input_class' => 'rbm-select2', 'no_options' => 'No courses available')); }
/** * Provides an easy to use link. * * @since 1.1.0 * * @param $name * @param bool $label * @param array $args */ function rbm_helper_field_link($name, $label = false, $args = array()) { echo '<fieldset class="rbm-fieldset rbm-field-button">'; echo "<legend>{$label} Button</legend>"; $pages = get_posts(wp_parse_args(array('post_type' => 'page', 'numberposts' => -1), $args)); $select_options = array(); if (!empty($pages)) { /** @var WP_Post $post */ foreach ($pages as $page) { $select_options[$page->ID] = $page->post_title; } } rbm_do_field_text("{$name}_text", 'Button Text'); rbm_do_field_select("{$name}_post_link", 'Post Link', false, array('options' => $select_options, 'input_class' => 'rbm-select2')); rbm_do_field_text("{$name}_external_link", 'Link (external)', false, array('description' => 'Overrides the Post Link', 'sanitization' => 'esc_url_raw')); rbm_do_field_checkbox("{$name}_new_tab", false, false, array('check_label' => 'Open in New Tab')); echo '</fieldset>'; }
function _mb_user_interaction() { rbm_do_field_select('user_interaction', 'Method', false, array('default' => 'default', 'options' => array('none' => 'None', 'close_button' => 'Close Button', 'call_to_action' => 'Call To Action'))); rbm_do_field_text('button_text', 'Button Text', false, array('description' => 'Defaults to "Close" or "Learn More" based on Method type.')); rbm_do_field_text('button_link', 'Button Link', false, array('description' => 'Only applies to Call To Action method.')); rbm_do_field_checkbox('button_new_tab', false, false, array('check_label' => 'Open in New Tab')); }
function _mb_properties() { rbm_do_field_text('course_code', 'Course Code', false, array('wrapper_class' => 'rbm-col-2', 'input_atts' => array('required' => ''))); rbm_do_field_number('credits', 'Credits', false, array('input_atts' => array('data-parsley-type' => 'number', 'style' => 'width: 3em;'), 'wrapper_class' => 'rbm-col-2')); rbm_do_field_select('type', 'Type', false, array('options' => array('general_education' => 'General Education', 'related_requirement' => 'Related Requirement', 'core_requirement' => 'Core Requirement', 'additional_requirement' => 'Additional Requirement'), 'wrapper_class' => 'rbm-col-2')); $error_code = $this->prerequisites_error_code ? "</span><span class=\"error\">{$this->prerequisites_error_code}</span>" : ''; echo '<div id="jcaca-prerequisites-anchor"></div>'; rbm_do_field_text('prerequisites', 'Prerequisites', false, array('wrapper_class' => 'jcaca-prerequisites rbm-col-2', 'description' => 'Start entering a course code (EG: COM, ACC, 101, 102, etc.) to view a list of existing courses.' . $error_code)); echo '<div class="clearfix"></div>'; rbm_do_field_text('notes', 'Notes'); }
/** * Metabox for enabling the page being a section. */ function jc_page_mb_section_properties() { global $current_screen; if (($is_section = rbm_get_field('is_section')) === '') { if ($current_screen->action == 'add') { $is_section = '1'; } } ?> <div class="is-section-checkbox"> <?php rbm_do_field_checkbox('is_section', 'Enable this page as a site section', $is_section, array('check_value' => '1')); ?> </div> <?php $classes = array_filter(array(rbm_get_field('section_sidebar') ? '' : 'no-sidebar', rbm_get_field('section_right_sidebar') ? '' : ' no-right-sidebar')); ?> <div id="jc-site-section-properties" class="<?php echo implode(' ', $classes); ?> "> <?php $posts = get_posts(array('post_type' => array_diff(get_post_types(array('public' => true)), array('page')), 'numberposts' => -1, 'order' => 'ASC', 'orderby' => 'title')); $post_options = array(); if ($posts) { foreach ($posts as $post) { if ($post_type_object = get_post_type_object($post->post_type)) { if (!isset($post_options[$post_type_object->labels->name])) { $post_options[$post_type_object->labels->name] = array($post->ID => $post->post_title); } else { $post_options[$post_type_object->labels->name][$post->ID] = $post->post_title; } } } } rbm_do_field_select('section_posts', 'Section Content Children', false, array('description' => 'All content selected will belong to this section as its children.', 'multiple' => true, 'opt_groups' => true, 'input_class' => 'rbm-select2', 'options' => array_diff_key($post_options, array('Programs' => '')))); wp_nonce_field('jc_save_site_sections', 'jc_site_sections'); $menu_options = array(); if ($menus = get_terms('nav_menu', array('hide_empty' => true))) { $menu_options = array('0' => '- No Menu -') + (array) wp_list_pluck($menus, 'name', 'term_id'); } rbm_do_field_select('section_menu', 'Section Menu', false, array('options' => $menu_options, 'input_class' => 'rbm-select2')); rbm_do_field_select('section_program_override', 'Program Override', false, array('options' => array(0 => '- No Program Override -') + $post_options['Programs'], 'input_class' => 'rbm-select2', 'description' => 'If a program is selected, this page will be overridden by that program.')); rbm_do_field_checkbox('section_sidebar', 'Section Left Sidebar', false, array('check_label' => 'Check to enable')); if (rbm_get_field('section_sidebar')) { ?> <p class="section-view-sidebar"> <a href="<?php echo admin_url('widgets.php'); ?> ">Edit Sidebar</a> </p> <?php } rbm_do_field_checkbox('section_right_sidebar', 'Section Right Sidebar', false, array('check_label' => 'Check to enable')); if (rbm_get_field('section_right_sidebar')) { ?> <p class="section-view-right-sidebar"> <a href="<?php echo admin_url('widgets.php'); ?> ">Edit Sidebar</a> </p> <?php } ?> </div> <?php }