function _featured_mb() { if (get_post_type() != 'jc-spotlight') { return; } echo '<div class="misc-pub-section">'; rbm_do_field_checkbox('featured', false, false, array('check_label' => 'Featured', 'wrapper_class' => 'jc-featured-checkbox')); echo '</div>'; }
function _mb_sponsor_hide_name() { rbm_do_field_checkbox('hide_name'); }
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')); }
/** * 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>'; }
/** * 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 }