/** * Register all the meta boxes for the Download custom post type * * @since 1.0 * @author Bryan Monzon * @return void */ function egt_add_meta_box() { $post_types = apply_filters('egt_metabox_post_types', array('campaigns')); foreach ($post_types as $post_type) { /** Class Configuration */ add_meta_box('campaigndetails', sprintf(__('%1$s Details', 'egt'), egt_get_label_singular(), egt_get_label_plural()), 'egt_render_meta_box', $post_type, 'side', 'core'); add_meta_box('donorlist', 'Donor List', 'egt_render_donor_list_meta_box', $post_type, 'normal', 'core'); } }
/** * Registers and sets up the Downloads custom post type * * @since 1.0 * @author Bryan Monzon * @return void */ function setup_egt_post_types() { global $egt_settings; //Check to see if anything is set in the settings area. if (!empty($egt_settings['team'])) { $slug = defined('EGT_SLUG') ? EGT_SLUG : $egt_settings['team']; } else { $slug = defined('EGT_SLUG') ? EGT_SLUG : 'teams'; } if (!isset($egt_settings['disable_archive'])) { $archives = true; } else { $archives = false; } $exclude_from_search = isset($egt_settings['exclude_from_search']) ? true : false; $rewrite = defined('EGT_DISABLE_REWRITE') && EGT_DISABLE_REWRITE ? false : array('slug' => $slug, 'with_front' => false); $team_labels = apply_filters('egt_team_labels', array('name' => '%2$s', 'singular_name' => '%1$s', 'add_new' => __('Add New', 'egt'), 'add_new_item' => __('Add New %1$s', 'egt'), 'edit_item' => __('Edit %1$s', 'egt'), 'new_item' => __('New %1$s', 'egt'), 'all_items' => __('All %2$s', 'egt'), 'view_item' => __('View %1$s', 'egt'), 'search_items' => __('Search %2$s', 'egt'), 'not_found' => __('No %2$s found', 'egt'), 'not_found_in_trash' => __('No %2$s found in Trash', 'egt'), 'parent_item_colon' => '', 'menu_name' => __('%2$s', 'egt'))); foreach ($team_labels as $key => $value) { $team_labels[$key] = sprintf($value, egt_get_label_singular(), egt_get_label_plural()); } $team_args = array('labels' => $team_labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_icon' => 'dashicons-groups', 'query_var' => true, 'exclude_from_search' => $exclude_from_search, 'rewrite' => $rewrite, 'map_meta_cap' => true, 'has_archive' => $archives, 'show_in_nav_menus' => true, 'hierarchical' => false, 'supports' => apply_filters('egt_supports', array('title', 'editor', 'thumbnail', 'excerpt'))); register_post_type('team', apply_filters('egt_post_type_args', $team_args)); }
/** * Retrieve the array of plugin settings * * @since 1.0 * @author Bryan Monzon * @return array */ function egt_get_registered_settings() { $pages = get_pages(); $pages_options = array(0 => ''); // Blank option if ($pages) { foreach ($pages as $page) { $pages_options[$page->ID] = $page->post_title; } } if (class_exists('RGFormsModel')) { $form_options = array(0 => ''); // Blank option $forms = RGFormsModel::get_forms(null, 'title'); if ($forms) { foreach ($forms as $form) { $form_options[$form->id] = $form->title; } } } /** * 'Whitelisted' EGT settings, filters are provided for each settings * section to allow extensions and other plugins to add their own settings */ $egt_settings = array('general' => apply_filters('egt_settings_general', array('basic_settings' => array('id' => 'basic_settings', 'name' => '<strong>' . __('Basic Settings', 'egt') . '</strong>', 'desc' => '', 'type' => 'header'), 'team' => array('id' => 'team', 'name' => __(egt_get_label_plural() . ' URL Slug', 'egt'), 'desc' => __('Enter the slug you would like to use for your ' . strtolower(egt_get_label_plural()) . '. (<em>You will need to <a href="' . admin_url('options-permalink.php') . '">refresh permalinks</a>, after saving changes</em>).', 'egt'), 'type' => 'text', 'size' => 'medium', 'std' => strtolower(egt_get_label_plural())), 'team_label_plural' => array('id' => 'team_label_plural', 'name' => __(egt_get_label_plural() . ' Label Plural', 'egt'), 'desc' => __('Enter the label you would like to use for your ' . strtolower(egt_get_label_plural()) . '.', 'egt'), 'type' => 'text', 'size' => 'medium', 'std' => egt_get_label_plural()), 'team_label_singular' => array('id' => 'team_label_singular', 'name' => __(egt_get_label_singular() . ' Label Singular', 'egt'), 'desc' => __('Enter the label you would like to use for your ' . strtolower(egt_get_label_singular()) . '.', 'egt'), 'type' => 'text', 'size' => 'medium', 'std' => egt_get_label_singular()), 'disable_archive' => array('id' => 'disable_archive', 'name' => __('Disable Archives Page', 'egt'), 'desc' => __('Check to disable archives page. (<em>You might need to <a href="' . admin_url('options-permalink.php') . '">refresh permalinks</a>, after saving changes</em>).', 'egt'), 'type' => 'checkbox', 'std' => ''), 'exclude_from_search' => array('id' => 'exclude_from_search', 'name' => __('Exclude from Search', 'egt'), 'desc' => __('Check to exclude from search. (<em>You might need to <a href="' . admin_url('options-permalink.php') . '">refresh permalinks</a>, after saving changes</em>)', 'egt'), 'type' => 'checkbox', 'std' => '')))); return $egt_settings; }