<?php

$gmap_styles = getGooglemapStyles();
// Switcher choises
$THEMEREX_shortcodes_yes_no = getYesNoList();
$THEMEREX_shortcodes_on_off = getOnOffList();
$THEMEREX_shortcodes_dir = getDirectionList();
$THEMEREX_shortcodes_align = getAlignmentList();
$THEMEREX_shortcodes_text_align = getAlignList();
$THEMEREX_shortcodes_float = getFloatList();
$THEMEREX_shortcodes_show_hide = getShowHideList();
$THEMEREX_shortcodes_box_style = getBoxStyles();
$THEMEREX_shortcodes_sorting = getSortingList();
$THEMEREX_shortcodes_ordering = getOrderingList();
$THEMEREX_shortcodes_sliders = getSlidersList();
$THEMEREX_shortcodes_users = getUsersList();
$THEMEREX_shortcodes_categories = getCategoriesList();
$THEMEREX_shortcodes_columns = getColumnsList();
$THEMEREX_shortcodes_images = themerex_array_merge(array('none' => "none"), getListFiles("/images/icons", "png"));
$THEMEREX_shortcodes_icons = array_merge(array("none"), getIconsList());
$THEMEREX_shortcodes_locations = getDedicatedLocationsList();
global $THEMEREX_shortcodes_yes_no;
// Current elemnt id
$THEMEREX_shortcodes_id = array("id" => "id", "title" => __("Element ID", "themerex"), "desc" => __("ID for current element", "themerex"), "divider" => false, "value" => "", "type" => "text");
// Width and height params
function THEMEREX_shortcodes_width($w = '')
{
    return array("id" => "width", "title" => __("Width", "themerex"), "divider" => false, "value" => $w, "type" => "text");
}
function THEMEREX_shortcodes_height($h = '', $des = 'Width (in pixels or percent) and height (only in pixels) of element')
{
<?php

global $THEMEREX_shortname;
$THEMEREX_shortname = 'wps';
// Prepare arrays
$fonts = getThemeFontsList(false);
$themes = getThemesList(false);
$socials = getSocialsList(false);
$puzzles = getPuzzlesList(false);
$categories = getCategoriesList(false);
$sidebars = getSidebarsList(false);
$positions = getSidebarsPositions(false);
$blog_styles = getBlogStylesList(false);
$body_styles = getBodyStylesList(false);
$sliders = getSlidersList(false);
$yes_no = getYesNoList(false);
$dir = getDirectionList(false);
$show_hide = getShowHideList(false);
$sorting = getSortingList(false);
$ordering = getOrderingList(false);
// Theme options arrays
$THEMEREX_theme_options = array();
/*
###############################
#### General               #### 
###############################
*/
$THEMEREX_theme_options[] = array("name" => __('General', 'themerex'), "override" => "category,post,page", "type" => "heading");
$THEMEREX_theme_options[] = array("name" => __('Contact form email', 'themerex'), "desc" => __('E-mail for send contact form and user registration data', 'themerex'), "id" => $THEMEREX_shortname . "_" . "contact_email", "std" => "", "type" => "text");
$THEMEREX_theme_options[] = array("name" => __('Favicon', 'themerex'), "desc" => __('Upload a 16px x 16px image that will represent your website\'s favicon.<br /><br /><em>To ensure cross-browser compatibility, we recommend converting the favicon into .ico format before uploading. (<a href="http://www.favicon.cc/">www.favicon.cc</a>)</em>', 'themerex'), "id" => $THEMEREX_shortname . "_" . "favicon", "std" => "", "type" => "upload");
$THEMEREX_theme_options[] = array("name" => __('Logo image', 'themerex'), "desc" => __('Upload logo image', 'themerex'), "id" => $THEMEREX_shortname . "_" . "logo_image", "std" => "", "type" => "mediamanager");
if (is_themerex_options_used()) {
    $fonts = getThemeFontsList();
    $themes = getThemesList();
    $socials = getSocialsList();
    $icons = getIconsList();
    $categories = getCategoriesList();
    $sidebars = getSidebarsList();
    $positions = getSidebarsPositions();
    $body_styles = getBodyStylesList();
    $blog_styles = getBlogStylesList();
    $hovers = getHoversList();
    $sliders = getSlidersList();
    $popups = getPopupEngines();
    $gmap_styles = getGooglemapStyles();
    $dir = getDirectionList();
    $yes_no = getYesNoList();
    $on_off = getOnOffList();
    $show_hide = getShowHideList();
    $sorting = getSortingList();
    $ordering = getOrderingList();
} else {
    $hovers = $fonts = $themes = $socials = $icons = $categories = $sidebars = $positions = $body_styles = $blog_styles = $sliders = $popups = $gmap_styles = $dir = $yes_no = $on_off = $show_hide = $sorting = $ordering = array();
}
// Theme options arrays
$THEMEREX_options = array();
//###############################
//#### General               ####
//###############################
$THEMEREX_options[] = array("title" => __('General', 'themerex'), "id" => "partition_general", "start" => "partitions", "override" => "category,post,page", "icon" => "iconadmin-wrench", "divider" => false, "type" => "partition");
$THEMEREX_options[] = array("title" => __('General parameters', 'themerex'), "desc" => __('Select (or upload) logo and favicon, advertisement parameters, etc.', 'themerex'), "override" => "category,post,page", "type" => "info");
$THEMEREX_options[] = array("title" => __('Contact form email', 'themerex'), "desc" => __('E-mail for send contact form and user registration data', 'themerex'), "id" => "contact_email", "std" => "", "before" => array('icon' => 'iconadmin-mail-1'), "type" => "text");
Example #4
0
<?php

add_post_type_support('post', array('excerpt', 'post-formats'));
$THEMEREX_meta_box_post = array('id' => 'post-meta-box', 'title' => __('Post Options', 'themerex'), 'page' => 'post', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array("title" => __('Reviews', 'themerex'), "override" => "post", "divider" => false, "id" => "partition_reviews", "icon" => "icon-cog", "type" => "partition"), array("title" => __('Reviews criterias for this post', 'themerex'), "override" => "post", "desc" => __('In this section you can put your reviews marks', 'themerex'), "class" => "reviews_meta", "type" => "info"), array("title" => __('Show reviews block', 'themerex'), "desc" => __("Show reviews block on single post page and average reviews rating after post's title in stream pages", 'themerex'), "override" => "post", "id" => "show_reviews", "class" => "reviews_meta", "std" => "inherit", "type" => "radio", "style" => "horizontal", "options" => getYesNoList()), array("title" => __('Reviews marks', 'themerex'), "override" => "post", "desc" => __("Marks for this review.", 'themerex'), "id" => "reviews_marks", "class" => "reviews_meta reviews_tab reviews_users", "std" => "", "type" => "reviews", "options" => get_theme_option('reviews_criterias'))));
// Add meta box
add_action('admin_menu', 'add_meta_box_post');
function add_meta_box_post()
{
    global $THEMEREX_meta_box_post;
    add_meta_box($THEMEREX_meta_box_post['id'], $THEMEREX_meta_box_post['title'], 'show_meta_box_post', $THEMEREX_meta_box_post['page'], $THEMEREX_meta_box_post['context'], $THEMEREX_meta_box_post['priority']);
}
// Callback function to show fields in meta box
function show_meta_box_post()
{
    global $THEMEREX_meta_box_post, $post, $THEMEREX_options;
    // Use nonce for verification
    echo '<input type="hidden" name="meta_box_post_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
    // Nonce for ajax queries
    $THEMEREX_ajax_nonce = wp_create_nonce('ajax_nonce');
    $THEMEREX_ajax_url = admin_url('admin-ajax.php');
    $maxLevel = max(5, (int) get_theme_option('reviews_max_level'));
    $custom_options = get_post_meta($post->ID, 'post_custom_options', true);
    if (isset($custom_options['reviews_marks'])) {
        $custom_options['reviews_marks'] = marksToDisplay($custom_options['reviews_marks']);
    }
    $post_options = array_merge($THEMEREX_options, $THEMEREX_meta_box_post['fields']);
    themerex_options_load_scripts();
    themerex_options_prepare_js('post');
    ?>
    
    <script type="text/javascript">
<?php

add_post_type_support('post', array('excerpt', 'post-formats'));
$THEMEREX_meta_box_post = array('id' => 'post-meta-box', 'title' => __('Post Options', 'themerex'), 'page' => 'post', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array("title" => __('Post options', 'themerex'), "override" => "post", "divider" => false, "id" => "partition_post_options", "icon" => "icon-cog", "type" => "partition"), array("title" => __('Reviews criterias for this post', 'themerex'), "override" => "post", "desc" => __('In this section you can put your reviews marks', 'themerex'), "class" => "reviews_meta", "type" => "info"), array("title" => __('Show reviews block', 'themerex'), "desc" => __("Show reviews block on single post page and average reviews rating after post's title in stream pages", 'themerex'), "override" => "post", "id" => "show_reviews", "class" => "reviews_meta", "std" => "inherit", "type" => "radio", "style" => "horizontal", "options" => getYesNoList()), array("title" => __('Reviews Style', 'themerex'), "desc" => __("Show rating marks as text or as stars/progress bars.", 'themerex'), "override" => "post", "id" => "reviews_style", "class" => "reviews_meta", "std" => "inherit", "type" => "select", "options" => array('text' => __('As text (for example: 7.5 / 10)', 'themerex'), 'star' => __('As one star', 'themerex'), '5stars' => __('As 5 stars', 'themerex'), '10stars' => __('As 10 stars', 'themerex'), 'circular' => __('As circular diagram', 'themerex'))), array("title" => __('Review points color', 'themerex'), "desc" => __("Color of review points", 'themerex'), "override" => "post", "id" => "review_color", "class" => "reviews_meta", "std" => "inherit", "type" => "color"), array("title" => __('Reviews marks', 'themerex'), "override" => "post", "desc" => __("Marks for this review.", 'themerex'), "id" => "reviews_marks", "class" => "reviews_meta reviews_tab reviews_users", "std" => "", "type" => "reviews", "options" => get_theme_option('reviews_criterias'))));
// Add meta box
add_action('admin_menu', 'add_meta_box_post');
function add_meta_box_post()
{
    global $THEMEREX_meta_box_post;
    add_meta_box($THEMEREX_meta_box_post['id'], $THEMEREX_meta_box_post['title'], 'show_meta_box_post', $THEMEREX_meta_box_post['page'], $THEMEREX_meta_box_post['context'], $THEMEREX_meta_box_post['priority']);
}
// Callback function to show fields in meta box
function show_meta_box_post()
{
    global $THEMEREX_meta_box_post, $post, $THEMEREX_options;
    // Use nonce for verification
    echo '<input type="hidden" name="meta_box_post_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
    // Nonce for ajax queries
    $THEMEREX_ajax_nonce = wp_create_nonce('ajax_nonce');
    $THEMEREX_ajax_url = admin_url('admin-ajax.php');
    $maxLevel = max(5, (int) get_theme_option('reviews_max_level'));
    $custom_options = get_post_meta($post->ID, 'post_custom_options', true);
    if (isset($custom_options['reviews_marks'])) {
        $custom_options['reviews_marks'] = marksToDisplay($custom_options['reviews_marks']);
    }
    $post_options = array_merge($THEMEREX_options, $THEMEREX_meta_box_post['fields']);
    themerex_options_load_scripts();
    themerex_options_prepare_js();
    wp_enqueue_script('_admin', get_template_directory_uri() . '/js/_admin.js', array('jquery'), null, true);
    ?>