function expert_list()
{
    if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
        $experts = array('no_expert' => 'Choose teacher for course');
        $experts_args = array('post_type' => 'teachers', 'post_status' => 'publish', 'posts_per_page' => -1);
        $experts_query = new WP_Query($experts_args);
        foreach ($experts_query->posts as $expert) {
            $experts[$expert->ID] = $expert->post_title;
        }
        if (!empty($experts)) {
            STM_PostType::addMetaBox('stm_woo_product_expert', __('Course Teacher', STM_POST_TYPE), array('product'), '', '', '', array('fields' => array('course_expert' => array('label' => __('Teacher', STM_POST_TYPE), 'type' => 'select', 'options' => $experts, 'description' => 'Choose Teacher for course'))));
        }
        STM_PostType::addMetaBox('stm_woo_product_status', __('Course Details', STM_POST_TYPE), array('product'), '', '', '', array('fields' => array('course_status' => array('label' => __('Status', STM_POST_TYPE), 'type' => 'select', 'options' => array('no_status' => 'No Status', 'hot' => 'Hot', 'special' => 'Special', 'new' => 'New')), 'duration' => array('label' => __('Duration', STM_POST_TYPE), 'type' => 'text'), 'lectures' => array('label' => __('Lectures', STM_POST_TYPE), 'type' => 'text'), 'video' => array('label' => __('Video', STM_POST_TYPE), 'type' => 'text'), 'certificate' => array('label' => __('Certificate', STM_POST_TYPE), 'type' => 'text'))));
        STM_PostType::addMetaBox('stm_woo_product_button_link', __('Course Link', STM_POST_TYPE), array('product'), '', '', '', array('fields' => array('woo_course_url' => array('label' => __('URL', STM_POST_TYPE), 'type' => 'text'), 'woo_course_label' => array('label' => __('Button text', STM_POST_TYPE), 'type' => 'text'))));
    }
}
Ejemplo n.º 2
0
require_once 'post_type.class.php';
require_once 'event_metaboxes.php';
STM_PostType::registerPostType('event', __('Event', STM_DOMAIN), array('menu_icon' => 'dashicons-calendar', 'supports' => array('title', 'editor', 'thumbnail', 'comments'), 'taxonomies' => array('post_tag')));
STM_PostType::addTaxonomy('event_category', __('Categories', STM_DOMAIN), 'event');
STM_PostType::registerPostType('donation', __('Donation', STM_DOMAIN), array('menu_icon' => 'dashicons-download', 'supports' => array('title', 'editor', 'thumbnail', 'excerpt'), 'taxonomies' => array('post_tag')));
STM_PostType::addTaxonomy('donation_category', __('Categories', STM_DOMAIN), 'donation');
STM_PostType::registerPostType('volunteer', __('Volunteer', STM_DOMAIN), array('menu_icon' => 'dashicons-universal-access', 'supports' => array('title', 'thumbnail', 'excerpt'), 'exclude_from_search' => true, 'publicly_queryable' => false));
STM_PostType::registerPostType('testimonial', __('Testimonial', STM_DOMAIN), array('menu_icon' => 'dashicons-testimonial', 'supports' => array('title', 'thumbnail', 'excerpt'), 'exclude_from_search' => true, 'publicly_queryable' => false));
STM_PostType::registerPostType('gallery', __('Gallery Image', STM_DOMAIN), array('menu_icon' => 'dashicons-format-gallery', 'supports' => array('title', 'thumbnail'), 'exclude_from_search' => true, 'publicly_queryable' => false));
STM_PostType::registerPostType('donor', __('Donor', STM_DOMAIN), array('supports' => array('title'), 'exclude_from_search' => true, 'publicly_queryable' => false, 'show_in_menu' => 'edit.php?post_type=donation'));
STM_PostType::addMetaBox('page_options', __('Page Options', STM_DOMAIN), array('page', 'post', 'event', 'donation'), '', '', '', array('fields' => array('separator_page_background' => array('label' => __('Page Background', STM_DOMAIN), 'type' => 'separator'), 'page_bg_image' => array('label' => __('Background Image', STM_DOMAIN), 'type' => 'image'), 'page_bg_position' => array('label' => __('Background Position', STM_DOMAIN), 'type' => 'text'), 'page_bg_repeat' => array('label' => __('Background Repeat', STM_DOMAIN), 'type' => 'select', 'options' => array('repeat' => __('Repeat', STM_DOMAIN), 'no-repeat' => __('No Repeat', STM_DOMAIN), 'repeat-x' => __('Repeat-X', STM_DOMAIN), 'repeat-y' => __('Repeat-Y', STM_DOMAIN))), 'separator_title_box' => array('label' => __('Title Box', STM_DOMAIN), 'type' => 'separator'), 'title' => array('label' => __('Title', STM_DOMAIN), 'type' => 'select', 'options' => array('show' => __('Show', STM_DOMAIN), 'hide' => __('Hide', STM_DOMAIN))), 'title_box_bg_color' => array('label' => __('Background Color', STM_DOMAIN), 'type' => 'color_picker'), 'title_box_font_color' => array('label' => __('Font Color', STM_DOMAIN), 'type' => 'color_picker'), 'title_box_bg_image' => array('label' => __('Background Image', STM_DOMAIN), 'type' => 'select', 'options' => array('none' => __('None', STM_DOMAIN), 'default_1' => __('Default 1', STM_DOMAIN), 'default_2' => __('Default 2', STM_DOMAIN), 'default_3' => __('Default 3', STM_DOMAIN), 'default_4' => __('Default 4', STM_DOMAIN), 'default_5' => __('Default 5', STM_DOMAIN), 'default_6' => __('Default 6', STM_DOMAIN), 'default_7' => __('Default 7', STM_DOMAIN))), 'title_box_custom_bg_image' => array('label' => __('Custom Background Image', STM_DOMAIN), 'type' => 'image'), 'title_box_bg_position' => array('label' => __('Background Position', STM_DOMAIN), 'type' => 'text'), 'title_box_bg_repeat' => array('label' => __('Background Repeat', STM_DOMAIN), 'type' => 'select', 'options' => array('repeat' => __('Repeat', STM_DOMAIN), 'no-repeat' => __('No Repeat', STM_DOMAIN), 'repeat-x' => __('Repeat-X', STM_DOMAIN), 'repeat-y' => __('Repeat-Y', STM_DOMAIN))))));
STM_PostType::addMetaBox('donation_information', __('Donation Information', STM_DOMAIN), array('donation'), '', '', '', array('fields' => array('donation_target' => array('label' => __('Target Amount', STM_DOMAIN), 'type' => 'text'), 'donation_raised' => array('label' => __('Raised Amount', STM_DOMAIN), 'type' => 'text'), 'donation_currency' => array('label' => __('Currency', STM_DOMAIN), 'type' => 'text'), 'donation_donors' => array('label' => __('Donors Count', STM_DOMAIN), 'type' => 'text'))));
STM_PostType::addMetaBox('sidebar_options', __('Sidebar Options', STM_DOMAIN), array('page', 'post'), '', '', '', array('fields' => array('sidebar_position' => array('label' => __('Sidebar Position', STM_DOMAIN), 'type' => 'select', 'options' => array('right' => __('Right', STM_DOMAIN), 'left' => __('Left', STM_DOMAIN), 'none' => __('None', STM_DOMAIN))))));
STM_PostType::addMetaBox('volunteer_info', __('Volunteer Info', STM_DOMAIN), array('volunteer'), '', '', '', array('fields' => array('volunteer_email' => array('label' => __('Email', STM_DOMAIN), 'type' => 'text'), 'volunteer_age' => array('label' => __('Age', STM_DOMAIN), 'type' => 'text'), 'volunteer_city' => array('label' => __('City', STM_DOMAIN), 'type' => 'text'), 'volunteer_phone' => array('label' => __('Phone', STM_DOMAIN), 'type' => 'text'), 'volunteer_major' => array('label' => __('Major', STM_DOMAIN), 'type' => 'text'), 'volunteer_zip' => array('label' => __('ZIP code', STM_DOMAIN), 'type' => 'text'), 'volunteer_facebook' => array('label' => __('Facebook', STM_DOMAIN), 'type' => 'text'), 'volunteer_twitter' => array('label' => __('Twitter', STM_DOMAIN), 'type' => 'text'))));
STM_PostType::addMetaBox('testimonial_info', __('Testimonial Info', STM_DOMAIN), array('testimonial'), '', '', '', array('fields' => array('testimonial_city' => array('label' => __('City', STM_DOMAIN), 'type' => 'text'))));
STM_PostType::addMetaBox('donor_info', __('Donor Info', STM_DOMAIN), array('donor'), '', '', '', array('fields' => array('donor_email' => array('label' => __('Email', STM_DOMAIN), 'type' => 'text'), 'donor_phone' => array('label' => __('Phone', STM_DOMAIN), 'type' => 'text'), 'donor_address' => array('label' => __('Address', STM_DOMAIN), 'type' => 'text'), 'donor_note' => array('label' => __('Additional Note', STM_DOMAIN), 'type' => 'text'), 'donor_amount' => array('label' => __('Amount', STM_DOMAIN), 'type' => 'text'), 'donor_donation' => array('label' => __('Donation', STM_DOMAIN), 'type' => 'text'))));
add_action('admin_menu', 'stm_register_donation_options_menu');
if (!function_exists('stm_register_donation_options_menu')) {
    function stm_register_donation_options_menu()
    {
        add_submenu_page('edit.php?post_type=donation', __('Donation options', STM_DOMAIN), __('Donation options', STM_DOMAIN), 'manage_options', 'donation', 'stm_donation_options');
    }
}
if (!function_exists('donation_options')) {
    function stm_donation_options()
    {
        if (!empty($_POST['donation_options'])) {
            set_theme_mod('donation_options', $_POST['donation_options']);
        }
        $options = get_theme_mod('donation_options');
        $defaultDonationOptions = array('email' => '*****@*****.**', 'currency' => 'USD', 'admin_email_subject' => 'Put email subject Here', 'admin_email_message' => 'Put email content Here', 'donor_email_subject' => 'Put email subject Here', 'donor_email_message' => 'Put email content Here', 'mode' => 'sandbox');
Ejemplo n.º 3
0
Description: STM Post Type
Author: Stylemix Themes
Author URI: http://stylemixthemes.com/
Text Domain: stm_post_type
Version: 1.0
*/
define('STM_POST_TYPE', 'stm_post_type');
$plugin_path = dirname(__FILE__);
require_once $plugin_path . '/post_type.class.php';
STM_PostType::registerPostType('project', __('Project', STM_POST_TYPE), array('menu_icon' => 'dashicons-building', 'supports' => array('title', 'editor', 'thumbnail', 'comments', 'excerpt')));
STM_PostType::addTaxonomy('project_category', __('Categories', STM_POST_TYPE), 'project');
STM_PostType::registerPostType('service', __('Service', STM_POST_TYPE), array('menu_icon' => 'dashicons-lightbulb', 'supports' => array('title', 'editor', 'thumbnail', 'comments', 'excerpt')));
STM_PostType::registerPostType('testimonial', __('Testimonial', STM_POST_TYPE), array('menu_icon' => 'dashicons-testimonial', 'supports' => array('title', 'thumbnail', 'excerpt'), 'exclude_from_search' => true, 'publicly_queryable' => false));
STM_PostType::registerPostType('sidebar', __('Sidebar', STM_POST_TYPE), array('menu_icon' => 'dashicons-schedule', 'supports' => array('title', 'editor'), 'exclude_from_search' => true, 'publicly_queryable' => false));
STM_PostType::addMetaBox('page_options', __('Page Options', STM_POST_TYPE), array('page', 'post', 'service', 'project', 'product'), '', '', '', array('fields' => array('separator_page_background' => array('label' => __('Page Background', STM_POST_TYPE), 'type' => 'separator'), 'page_bg_image' => array('label' => __('Background Image', STM_POST_TYPE), 'type' => 'image'), 'page_bg_position' => array('label' => __('Background Position', STM_POST_TYPE), 'type' => 'text'), 'page_bg_repeat' => array('label' => __('Background Repeat', STM_POST_TYPE), 'type' => 'select', 'options' => array('repeat' => __('Repeat', STM_POST_TYPE), 'no-repeat' => __('No Repeat', STM_POST_TYPE), 'repeat-x' => __('Repeat-X', STM_POST_TYPE), 'repeat-y' => __('Repeat-Y', STM_POST_TYPE))), 'separator_title_box' => array('label' => __('Title Box', STM_POST_TYPE), 'type' => 'separator'), 'title' => array('label' => __('Title', STM_POST_TYPE), 'type' => 'select', 'options' => array('show' => __('Show', STM_POST_TYPE), 'hide' => __('Hide', STM_POST_TYPE))), 'sub_title' => array('label' => __('Sub Title', STM_POST_TYPE), 'type' => 'text'), 'title_box_bg_color' => array('label' => __('Background Color', STM_POST_TYPE), 'type' => 'color_picker'), 'title_box_font_color' => array('label' => __('Font Color', STM_POST_TYPE), 'type' => 'color_picker'), 'title_box_line_color' => array('label' => __('Line Color', STM_POST_TYPE), 'type' => 'color_picker'), 'title_box_subtitle_font_color' => array('label' => __('Sub Title Font Color', STM_POST_TYPE), 'type' => 'color_picker'), 'title_box_custom_bg_image' => array('label' => __('Custom Background Image', STM_POST_TYPE), 'type' => 'image'), 'title_box_bg_position' => array('label' => __('Background Position', STM_POST_TYPE), 'type' => 'text'), 'title_box_bg_repeat' => array('label' => __('Background Repeat', STM_POST_TYPE), 'type' => 'select', 'options' => array('repeat' => __('Repeat', STM_POST_TYPE), 'no-repeat' => __('No Repeat', STM_POST_TYPE), 'repeat-x' => __('Repeat-X', STM_POST_TYPE), 'repeat-y' => __('Repeat-Y', STM_POST_TYPE))), 'title_box_overlay' => array('label' => __('Overlay', STM_POST_TYPE), 'type' => 'checkbox'), 'title_box_small' => array('label' => __('Small', STM_POST_TYPE), 'type' => 'checkbox'), 'separator_breadcrumbs' => array('label' => __('Breadcrumbs', STM_POST_TYPE), 'type' => 'separator'), 'breadcrumbs' => array('label' => __('Breadcrumbs', STM_POST_TYPE), 'type' => 'select', 'options' => array('show' => __('Show', STM_POST_TYPE), 'hide' => __('Hide', STM_POST_TYPE))), 'breadcrumbs_font_color' => array('label' => __('Breadcrumbs Color', STM_POST_TYPE), 'type' => 'color_picker'), 'separator_title_box_button' => array('label' => __('Title Box Button', STM_POST_TYPE), 'type' => 'separator'), 'title_box_button_text' => array('label' => __('Button Text', STM_POST_TYPE), 'type' => 'text'), 'title_box_button_url' => array('label' => __('Button URL', STM_POST_TYPE), 'type' => 'text'), 'title_box_button_border_color' => array('label' => __('Border Color', STM_POST_TYPE), 'type' => 'color_picker', 'default' => '#ffffff'), 'title_box_button_font_color' => array('label' => __('Font Color', STM_POST_TYPE), 'type' => 'color_picker', 'default' => '#333333'), 'title_box_button_font_color_hover' => array('label' => __('Font Color (hover)', STM_POST_TYPE), 'type' => 'color_picker', 'default' => '#333333'), 'title_box_button_font_arrow_color' => array('label' => __('Arrow Color', STM_POST_TYPE), 'type' => 'color_picker', 'default' => '#ffffff'), 'prev_next_buttons_title_box' => array('label' => __('Prev/Next Buttons', STM_POST_TYPE), 'type' => 'separator'), 'prev_next_buttons' => array('label' => __('Enable', STM_POST_TYPE), 'type' => 'checkbox'), 'prev_next_buttons_border_color' => array('label' => __('Border Color', STM_POST_TYPE), 'type' => 'color_picker', 'default' => '#ffffff'), 'prev_next_buttons_arrow_color_hover' => array('label' => __('Arrow Color (hover)', STM_POST_TYPE), 'type' => 'color_picker', 'default' => '#dac725'))));
STM_PostType::addMetaBox('testimonial_info', __('Testimonial Info', STM_POST_TYPE), array('testimonial'), '', '', '', array('fields' => array('testimonial_company' => array('label' => __('Company', STM_POST_TYPE), 'type' => 'text'), 'testimonial_profession' => array('label' => __('Profession', STM_POST_TYPE), 'type' => 'text'))));
function stm_plugin_styles()
{
    $plugin_url = plugins_url('', __FILE__);
    wp_enqueue_style('admin-styles', $plugin_url . '/assets/css/admin.css', null, null, 'all');
    wp_enqueue_style('wp-color-picker');
    wp_enqueue_script('wp-color-picker');
    wp_enqueue_style('stmcss-datetimepicker', $plugin_url . '/assets/css/jquery.stmdatetimepicker.css', null, null, 'all');
    wp_enqueue_script('stmjs-datetimepicker', $plugin_url . '/assets/js/jquery.stmdatetimepicker.js', array('jquery'), null, true);
    wp_enqueue_media();
}
add_action('admin_enqueue_scripts', 'stm_plugin_styles');
add_action('plugins_loaded', 'stm_plugin_setup');
function stm_plugin_setup()
{
    $plugin_url = plugins_url('', __FILE__);