mh_customize_register

The MH Corporate lite mh customize register function.

Description

mh_customize_register( $wp_customize ); 

Parameters (1)

0. $wp_customize
The wp customize.

Usage

  1. if ( !function_exists( 'mh_customize_register' ) ) { 
  2. require_once '/includes/mh-options.php'; 
  3.  
  4. // The wp customize. 
  5. $wp_customize = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = mh_customize_register($wp_customize); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/mh-options.php  
  1. function mh_customize_register($wp_customize) { 
  2.  
  3. /***** Register Custom Controls *****/ 
  4.  
  5. class MH_Customize_Header_Control extends WP_Customize_Control { 
  6. public function render_content() { ?> 
  7. <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> <?php 
  8.  
  9. class MH_Customize_Text_Control extends WP_Customize_Control { 
  10. public function render_content() { ?> 
  11. <span class="textfield"><?php echo esc_html($this->label); ?></span> <?php 
  12.  
  13. class MH_Customize_Button_Control extends WP_Customize_Control { 
  14. public function render_content() { ?> 
  15. <p> 
  16. <a href="http://www.mhthemes.com/themes/mh/corporate/" target="_blank" class="button button-secondary"><?php echo esc_html($this->label); ?></a> 
  17. </p> <?php 
  18.  
  19. /***** Add Sections *****/ 
  20.  
  21. $wp_customize->add_section('mh_general', array('title' => __('Theme Options', 'mhc'), 'priority' => 1)); 
  22. $wp_customize->add_section('mh_upgrade', array('title' => __('Upgrade to Premium', 'mhc'), 'priority' => 999)); 
  23.  
  24. /***** Add Settings *****/ 
  25.  
  26. $wp_customize->add_setting('mhc_options[excerpt_length]', array('default' => '300', 'type' => 'option', 'sanitize_callback' => 'mh_sanitize_integer')); 
  27. $wp_customize->add_setting('mhc_options[excerpt_more]', array('default' => '[...]', 'type' => 'option', 'sanitize_callback' => 'mh_sanitize_text')); 
  28. $wp_customize->add_setting('mhc_options[sb_position]', array('default' => 'right', 'type' => 'option', 'sanitize_callback' => 'mh_sanitize_select')); 
  29. $wp_customize->add_setting('mhc_options[full_bg]', array('default' => '', 'type' => 'option', 'sanitize_callback' => 'mh_sanitize_checkbox')); 
  30. $wp_customize->add_setting('mhc_options[premium_version_label]', array('default' => '', 'type' => 'option')); 
  31. $wp_customize->add_setting('mhc_options[premium_version_text]', array('default' => '', 'type' => 'option')); 
  32. $wp_customize->add_setting('mhc_options[premium_version_button]', array('default' => '', 'type' => 'option')); 
  33.  
  34. /***** Add Controls *****/ 
  35.  
  36. $wp_customize->add_control('excerpt_length', array('label' => __('Custom Excerpt Length in Characters', 'mhc'), 'section' => 'mh_general', 'settings' => 'mhc_options[excerpt_length]', 'priority' => 1, 'type' => 'text')); 
  37. $wp_customize->add_control('excerpt_more', array('label' => __('Custom Excerpt More-Text', 'mhc'), 'section' => 'mh_general', 'settings' => 'mhc_options[excerpt_more]', 'priority' => 2, 'type' => 'text')); 
  38. $wp_customize->add_control('sb_position', array('label' => __('Position of Sidebar', 'mhc'), 'section' => 'mh_general', 'settings' => 'mhc_options[sb_position]', 'priority' => 3, 'type' => 'select', 'choices' => array('left' => __('Left', 'mhc'), 'right' => __('Right', 'mhc')))); 
  39. $wp_customize->add_control('full_bg', array('label' => __('Scale Background Image to Full Size', 'mhc'), 'section' => 'background_image', 'settings' => 'mhc_options[full_bg]', 'priority' => 99, 'type' => 'checkbox')); 
  40. $wp_customize->add_control(new MH_Customize_Header_Control($wp_customize, 'premium_version_label', array('label' => __('Need more features and options?', 'mhc'), 'section' => 'mh_upgrade', 'settings' => 'mhc_options[premium_version_label]', 'priority' => 1))); 
  41. $wp_customize->add_control(new MH_Customize_Text_Control($wp_customize, 'premium_version_text', array('label' => __('Check out the Premium Version of this theme which comes with additional features and advanced customization options for your website.', 'mhc'), 'section' => 'mh_upgrade', 'settings' => 'mhc_options[premium_version_text]', 'priority' => 2))); 
  42. $wp_customize->add_control(new MH_Customize_Button_Control($wp_customize, 'premium_version_button', array('label' => __('Learn more about the Premium Version', 'mhc'), 'section' => 'mh_upgrade', 'settings' => 'mhc_options[premium_version_button]', 'priority' => 3)));