mh_customize_register

The MH Corporate basic 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-customizer.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-customizer.php  
  1. function mh_customize_register($wp_customize) { 
  2.  
  3. /***** Register Custom Controls *****/ 
  4.  
  5. class MH_Corporate_Basic_Upgrade extends WP_Customize_Control { 
  6. public function render_content() { ?> 
  7. <p class="mh-upgrade-thumb"> 
  8. <img src="<?php echo get_template_directory_uri(); ?>/images/mh_corporate.png" /> 
  9. </p> 
  10. <p class="customize-control-title mh-upgrade-title"> 
  11. <?php esc_html_e('MH Corporate Pro', 'mh-corporate-basic'); ?> 
  12. </p> 
  13. <p class="textfield mh-upgrade-text"> 
  14. <?php esc_html_e('If you like the free version of this theme, you will LOVE the full version of MH Corporate which includes unique custom widgets, additional features and more useful options to customize your website.', 'mh-corporate-basic'); ?> 
  15. </p> 
  16. <p class="customize-control-title mh-upgrade-title"> 
  17. <?php esc_html_e('Additional Features:', 'mh-corporate-basic'); ?> 
  18. </p> 
  19. <ul class="mh-upgrade-features"> 
  20. <li class="mh-upgrade-feature-item"> 
  21. <?php esc_html_e('Options to modify color scheme', 'mh-corporate-basic'); ?> 
  22. </li> 
  23. <li class="mh-upgrade-feature-item"> 
  24. <?php esc_html_e('Typography options', 'mh-corporate-basic'); ?> 
  25. </li> 
  26. <li class="mh-upgrade-feature-item"> 
  27. <?php esc_html_e('Several additional widget areas', 'mh-corporate-basic'); ?> 
  28. </li> 
  29. <li class="mh-upgrade-feature-item"> 
  30. <?php esc_html_e('Additional custom widgets', 'mh-corporate-basic'); ?> 
  31. </li> 
  32. <li class="mh-upgrade-feature-item"> 
  33. <?php esc_html_e('Social buttons, related articles, and more...', 'mh-corporate-basic'); ?> 
  34. </li> 
  35. </ul> 
  36. <p class="mh-button mh-upgrade-button"> 
  37. <a href="https://www.mhthemes.com/themes/mh/corporate/" target="_blank" class="button button-secondary"> 
  38. <?php esc_html_e('Upgrade to MH Corporate Pro', 'mh-corporate-basic'); ?> 
  39. </a> 
  40. </p> 
  41. <p class="mh-button"> 
  42. <a href="https://www.mhthemes.com/themes/showcase/" target="_blank" class="button button-secondary"> 
  43. <?php esc_html_e('MH Themes Showcase', 'mh-corporate-basic'); ?> 
  44. </a> 
  45. </p> 
  46. <p class="mh-button"> 
  47. <a href="https://www.mhthemes.com/support/documentation-mh-corporate/" target="_blank" class="button button-secondary"> 
  48. <?php esc_html_e('Theme Documentation', 'mh-corporate-basic'); ?> 
  49. </a> 
  50. </p> 
  51. <p class="mh-button"> 
  52. <a href="https://wordpress.org/support/theme/mh-corporate-basic" target="_blank" class="button button-secondary"> 
  53. <?php esc_html_e('Support Forum', 'mh-corporate-basic'); ?> 
  54. </a> 
  55. </p><?php 
  56.  
  57. /***** Add Panels *****/ 
  58.  
  59. $wp_customize->add_panel('mh_theme_options', array('title' => esc_html__('Theme Options', 'mh-corporate-basic'), 'description' => '', 'capability' => 'edit_theme_options', 'theme_supports' => '', 'priority' => 1)); 
  60.  
  61. /***** Add Sections *****/ 
  62.  
  63. $wp_customize->add_section('mh_corporate_basic_general', array('title' => esc_html__('General', 'mh-corporate-basic'), 'priority' => 1, 'panel' => 'mh_theme_options')); 
  64. $wp_customize->add_section('mh_corporate_basic_upgrade', array('title' => esc_html__('More Features', 'mh-corporate-basic'), 'priority' => 2, 'panel' => 'mh_theme_options')); 
  65.  
  66. /***** Add Settings *****/ 
  67.  
  68. $wp_customize->add_setting('mhc_options[excerpt_length]', array('default' => 300, 'type' => 'option', 'sanitize_callback' => 'mh_sanitize_integer')); 
  69. $wp_customize->add_setting('mhc_options[excerpt_more]', array('default' => '[...]', 'type' => 'option', 'sanitize_callback' => 'mh_sanitize_text')); 
  70. $wp_customize->add_setting('mhc_options[sb_position]', array('default' => 'right', 'type' => 'option', 'sanitize_callback' => 'mh_sanitize_select')); 
  71. $wp_customize->add_setting('mhc_options[full_bg]', array('default' => '', 'type' => 'option', 'sanitize_callback' => 'mh_sanitize_checkbox')); 
  72. $wp_customize->add_setting('mhc_options[premium_version_upgrade]', array('default' => '', 'type' => 'option', 'sanitize_callback' => 'esc_attr')); 
  73.  
  74. /***** Add Controls *****/ 
  75.  
  76. $wp_customize->add_control('excerpt_length', array('label' => esc_html__('Custom Excerpt Length in Characters', 'mh-corporate-basic'), 'section' => 'mh_corporate_basic_general', 'settings' => 'mhc_options[excerpt_length]', 'priority' => 1, 'type' => 'text')); 
  77. $wp_customize->add_control('excerpt_more', array('label' => esc_html__('Custom Excerpt More-Text', 'mh-corporate-basic'), 'section' => 'mh_corporate_basic_general', 'settings' => 'mhc_options[excerpt_more]', 'priority' => 2, 'type' => 'text')); 
  78. $wp_customize->add_control('sb_position', array('label' => esc_html__('Position of Sidebar', 'mh-corporate-basic'), 'section' => 'mh_corporate_basic_general', 'settings' => 'mhc_options[sb_position]', 'priority' => 3, 'type' => 'select', 'choices' => array('left' => esc_html__('Left', 'mh-corporate-basic'), 'right' => esc_html__('Right', 'mh-corporate-basic')))); 
  79. $wp_customize->add_control('full_bg', array('label' => esc_html__('Scale Background Image to Full Size', 'mh-corporate-basic'), 'section' => 'background_image', 'settings' => 'mhc_options[full_bg]', 'priority' => 99, 'type' => 'checkbox')); 
  80. $wp_customize->add_control(new MH_Corporate_Basic_Upgrade($wp_customize, 'premium_version_upgrade', array('section' => 'mh_corporate_basic_upgrade', 'settings' => 'mhc_options[premium_version_upgrade]', 'priority' => 1)));