コード例 #1
0
ファイル: help.php プロジェクト: unisexx/drtooth
		function wm_help( $contextual_help, $screen_id, $screen ) {
			global $helpTexts;

			if ( wm_check_wp_version( '3.3' ) ) {
			//WP3.3+

				if ( isset( $helpTexts[$screen_id] ) && is_array( $helpTexts[$screen_id] ) ) {
					$contextualHelpTabs = $helpTexts[$screen_id];
					foreach ( $contextualHelpTabs as $contextualHelpTab ) {
						$screen->add_help_tab( array(
							'id'      => $contextualHelpTab['tabId'],
							'title'   => $contextualHelpTab['tabTitle'],
							'content' => $contextualHelpTab['tabContent']
						) );
					}
				}

				//User Manual link everywhere
				$screen->add_help_tab( array(
					'id'      => 'theme-user-manual',
					'title'   => __( 'User Manual', 'lespaul_domain_help' ),
					'content' => '<h3>' . __( 'Theme online user manual', 'lespaul_domain_help' ) . '</h3><p>' . sprintf( __( 'For further assistance please check the online <a href="%1s" target="_blank">%2s User Manual</a>.', 'lespaul_domain_help' ), WM_ONLINE_MANUAL_URL, WM_THEME_NAME ) . '</p>',
				) );

			} else {
			//WP3.3-

				return $contextual_help;

			}
		}
コード例 #2
0
ファイル: customizer.php プロジェクト: bluefire42/modern
 function wm_theme_customizer($wp_customize)
 {
     //Make predefined controls use live preview JS
     $wp_customize->get_setting('blogname')->transport = 'postMessage';
     $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
     $wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
     /**
      * Custom customizer controls
      *
      * @link  https://github.com/bueltge/Wordpress-Theme-Customizer-Custom-Controls
      * @link  http://ottopress.com/2012/making-a-custom-control-for-the-theme-customizer/
      */
     locate_template(WM_INC_DIR . 'customizer/controls/class-WM_Customizer_Hidden.php', true);
     locate_template(WM_INC_DIR . 'customizer/controls/class-WM_Customizer_HTML.php', true);
     locate_template(WM_INC_DIR . 'customizer/controls/class-WM_Customizer_Image.php', true);
     locate_template(WM_INC_DIR . 'customizer/controls/class-WM_Customizer_Multiselect.php', true);
     locate_template(WM_INC_DIR . 'customizer/controls/class-WM_Customizer_Select.php', true);
     if (!wm_check_wp_version(4)) {
         locate_template(WM_INC_DIR . 'customizer/controls/class-WM_Customizer_Textarea.php', true);
     }
     do_action('wmhook_wm_theme_customizer_load_controls', $wp_customize);
     //Helper variables
     $theme_options = (array) apply_filters('wmhook_theme_options', array());
     ksort($theme_options);
     $allowed_option_types = apply_filters('wmhook_wm_theme_customizer_allowed_option_types', array('checkbox', 'color', 'hidden', 'html', 'image', 'multiselect', 'radio', 'range', 'select', 'text', 'textarea'));
     //To make sure our customizer sections start after WordPress default ones
     $priority = apply_filters('wmhook_wm_theme_customizer_priority', 900);
     //Default section name in case not set (should be overwritten anyway)
     $customizer_panel = '';
     $customizer_section = WM_THEME_SHORTNAME;
     /**
      * @todo  Consider switching from 'type' => 'theme_mod' to 'option' for better theme upgradability.
      */
     //Generate customizer options
     if (is_array($theme_options) && !empty($theme_options)) {
         foreach ($theme_options as $theme_option) {
             if (is_array($theme_option) && isset($theme_option['type']) && (in_array($theme_option['type'], $allowed_option_types) || isset($theme_option['create_section']))) {
                 //Helper variables
                 $priority++;
                 $option_id = $default = $description = '';
                 if (isset($theme_option['id'])) {
                     $option_id = $theme_option['id'];
                 }
                 if (isset($theme_option['default'])) {
                     $default = $theme_option['default'];
                 }
                 if (isset($theme_option['description'])) {
                     $description = $theme_option['description'];
                 }
                 $transport = isset($theme_option['customizer_js']) ? 'postMessage' : 'refresh';
                 /**
                  * Panels
                  *
                  * Panels are wrappers for customizer sections.
                  * Note that the panel will not display unless sections are assigned to it.
                  * Set the panel name in the section declaration with `in_panel`.
                  * Panel has to be defined for each section to prevent all sections within a single panel.
                  *
                  * @link  http://make.wordpress.org/core/2014/07/08/customizer-improvements-in-4-0/
                  */
                 if (isset($theme_option['in_panel'])) {
                     $panel_id = sanitize_title(trim($theme_option['in_panel']));
                     if ($customizer_panel !== $panel_id) {
                         $wp_customize->add_panel($panel_id, array('title' => $theme_option['in_panel'], 'description' => isset($theme_option['in_panel-description']) ? $theme_option['in_panel-description'] : '', 'priority' => $priority));
                         $customizer_panel = $panel_id;
                     }
                 }
                 /**
                  * Sections
                  */
                 if (isset($theme_option['create_section']) && trim($theme_option['create_section'])) {
                     if (empty($option_id)) {
                         $option_id = sanitize_title(trim($theme_option['create_section']));
                     }
                     $customizer_section = array('id' => $option_id, 'setup' => array('title' => $theme_option['create_section'], 'description' => isset($theme_option['create_section-description']) ? $theme_option['create_section-description'] : '', 'priority' => $priority));
                     if (!isset($theme_option['in_panel'])) {
                         $customizer_panel = '';
                     } else {
                         $customizer_section['setup']['panel'] = $customizer_panel;
                     }
                     $wp_customize->add_section($customizer_section['id'], $customizer_section['setup']);
                     $customizer_section = $customizer_section['id'];
                 }
                 /**
                  * Options generator
                  */
                 switch ($theme_option['type']) {
                     /**
                      * Color
                      */
                     case 'color':
                         $wp_customize->add_setting($option_id, array('type' => 'theme_mod', 'default' => trim($default, '#'), 'transport' => $transport, 'sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color'));
                         $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $option_id, array('label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority)));
                         break;
                         /**
                          * Hidden
                          */
                     /**
                      * Hidden
                      */
                     case 'hidden':
                         $wp_customize->add_setting($option_id, array('type' => 'theme_mod', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_attr', 'sanitize_js_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_attr'));
                         $wp_customize->add_control(new WM_Customizer_Hidden($wp_customize, $option_id, array('label' => 'HIDDEN FIELD', 'section' => $customizer_section, 'priority' => $priority)));
                         break;
                         /**
                          * HTML
                          */
                     /**
                      * HTML
                      */
                     case 'html':
                         if (empty($option_id)) {
                             $option_id = 'custom-title-' . $priority;
                         }
                         $wp_customize->add_setting($option_id, array('sanitize_callback' => 'wm_sanitize_text', 'sanitize_js_callback' => 'wm_sanitize_text'));
                         $wp_customize->add_control(new WM_Customizer_HTML($wp_customize, $option_id, array('label' => $theme_option['content'], 'section' => $customizer_section, 'priority' => $priority)));
                         break;
                         /**
                          * Image
                          */
                     /**
                      * Image
                      */
                     case 'image':
                         $wp_customize->add_setting($option_id, array('type' => 'theme_mod', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'wm_sanitize_return_value', 'sanitize_js_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'wm_sanitize_return_value'));
                         $wp_customize->add_control(new WM_Customizer_Image($wp_customize, $option_id, array('label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'context' => $option_id)));
                         break;
                         /**
                          * Checkbox, radio
                          */
                     /**
                      * Checkbox, radio
                      */
                     case 'checkbox':
                     case 'radio':
                         $wp_customize->add_setting($option_id, array('type' => 'theme_mod', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_attr', 'sanitize_js_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_attr'));
                         $wp_customize->add_control($option_id, array('label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'type' => $theme_option['type'], 'choices' => isset($theme_option['options']) ? $theme_option['options'] : ''));
                         break;
                         /**
                          * Multiselect
                          */
                     /**
                      * Multiselect
                      */
                     case 'multiselect':
                         $wp_customize->add_setting($option_id, array('type' => 'theme_mod', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'wm_sanitize_return_value', 'sanitize_js_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'wm_sanitize_return_value'));
                         $wp_customize->add_control(new WM_Customizer_Multiselect($wp_customize, $option_id, array('label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'choices' => isset($theme_option['options']) ? $theme_option['options'] : '')));
                         break;
                         /**
                          * Range
                          */
                     /**
                      * Range
                      */
                     case 'range':
                         $wp_customize->add_setting($option_id, array('type' => 'theme_mod', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'absint', 'sanitize_js_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'absint'));
                         if (wm_check_wp_version(4)) {
                             $wp_customize->add_control($option_id, array('label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'type' => 'range', 'input_attrs' => array('min' => isset($theme_option['min']) ? intval($theme_option['min']) : 0, 'max' => isset($theme_option['max']) ? intval($theme_option['max']) : 100, 'step' => isset($theme_option['step']) ? intval($theme_option['step']) : 1)));
                         } else {
                             $wp_customize->add_control($option_id, array('label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority));
                         }
                         break;
                         /**
                          * Select (with optgroups)
                          */
                     /**
                      * Select (with optgroups)
                      */
                     case 'select':
                         $wp_customize->add_setting($option_id, array('type' => 'theme_mod', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_attr', 'sanitize_js_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_attr'));
                         $wp_customize->add_control(new WM_Customizer_Select($wp_customize, $option_id, array('label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'choices' => isset($theme_option['options']) ? $theme_option['options'] : '')));
                         break;
                         /**
                          * Text
                          */
                     /**
                      * Text
                      */
                     case 'text':
                         $wp_customize->add_setting($option_id, array('type' => 'theme_mod', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_textarea', 'sanitize_js_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_textarea'));
                         $wp_customize->add_control($option_id, array('label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority));
                         break;
                         /**
                          * Textarea
                          *
                          * Since WordPress 4.0 this is native input field.
                          */
                     /**
                      * Textarea
                      *
                      * Since WordPress 4.0 this is native input field.
                      */
                     case 'textarea':
                         $wp_customize->add_setting($option_id, array('type' => 'theme_mod', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_textarea', 'sanitize_js_callback' => isset($theme_option['validate']) ? $theme_option['validate'] : 'esc_textarea'));
                         if (wm_check_wp_version(4)) {
                             $wp_customize->add_control($option_id, array('type' => 'textarea', 'label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority));
                         } else {
                             $wp_customize->add_control(new WM_Customizer_Textarea($wp_customize, $option_id, array('label' => $theme_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority)));
                         }
                         break;
                         /**
                          * Default
                          */
                     /**
                      * Default
                      */
                     default:
                         break;
                 }
                 // /switch
             }
             // /if suitable option array
         }
         // /foreach
     }
     // /if skin options are non-empty array
     //Assets needed for customizer preview
     if ($wp_customize->is_preview()) {
         add_action('wp_footer', 'wm_theme_customizer_js', 99);
     }
 }
コード例 #3
0
ファイル: skinning.php プロジェクト: pab44/pab44
 function wm_theme_customizer($wp_customize)
 {
     /**
      * Custom customizer controls
      *
      * @link  https://github.com/bueltge/Wordpress-Theme-Customizer-Custom-Controls
      * @link  http://ottopress.com/2012/making-a-custom-control-for-the-theme-customizer/
      */
     locate_template(WM_LIBRARY_DIR . 'includes/controls/class-WM_Customizer_Hidden.php', true);
     locate_template(WM_LIBRARY_DIR . 'includes/controls/class-WM_Customizer_HTML.php', true);
     // locate_template( WM_LIBRARY_DIR . 'includes/controls/class-WP_Customize_Image_Control.php',       true );
     locate_template(WM_LIBRARY_DIR . 'includes/controls/class-WM_Customizer_Multiselect.php', true);
     locate_template(WM_LIBRARY_DIR . 'includes/controls/class-WM_Customizer_Radiocustom.php', true);
     locate_template(WM_LIBRARY_DIR . 'includes/controls/class-WM_Customizer_Range.php', true);
     //Helper variables
     $wm_skin_design = (array) apply_filters('wmhook_theme_options_skin_array', array());
     $allowed_option_types = apply_filters('wmhook_wm_theme_customizer_allowed_option_types', array('background', 'checkbox', 'color', 'email', 'hidden', 'html', 'image', 'multiselect', 'password', 'radio', 'radiocustom', 'range', 'select', 'text', 'textarea', 'url'));
     //To make sure our customizer sections start after WordPress default ones
     $priority = apply_filters('wmhook_wm_theme_customizer_priority', 900);
     //Default section name in case not set (should be overwritten anyway)
     $customizer_panel = '';
     $customizer_section = WM_THEME_SHORTNAME;
     //Generate customizer options
     if (is_array($wm_skin_design) && !empty($wm_skin_design)) {
         foreach ($wm_skin_design as $skin_option) {
             if (is_array($skin_option) && isset($skin_option['type']) && (in_array($skin_option['type'], $allowed_option_types) || isset($skin_option['create_section']))) {
                 //Helper variables
                 $priority++;
                 $option_id = $default = $description = '';
                 if (isset($skin_option['id'])) {
                     $option_id = WM_THEME_SETTINGS_PREFIX . $skin_option['id'];
                 }
                 if (isset($skin_option['default'])) {
                     $default = $skin_option['default'];
                 }
                 if (isset($skin_option['description'])) {
                     $description = $skin_option['description'];
                 }
                 $transport = isset($skin_option['customizer_js']) ? 'postMessage' : 'refresh';
                 /**
                  * Panels
                  *
                  * Panels are wrappers for customizer sections.
                  * Note that the panel will not display unless sections are assigned to it.
                  * Set the panel name in the section declaration with `in_panel`.
                  * Panel has to be defined for each section to prevent all sections within a single panel.
                  *
                  * @link  http://make.wordpress.org/core/2014/07/08/customizer-improvements-in-4-0/
                  */
                 if (isset($skin_option['in_panel'])) {
                     $panel_id = sanitize_title(trim($skin_option['in_panel']));
                     if ($customizer_panel !== $panel_id) {
                         $wp_customize->add_panel($panel_id, array('title' => $skin_option['in_panel'], 'description' => isset($skin_option['in_panel-description']) ? $skin_option['in_panel-description'] : '', 'priority' => $priority));
                         $customizer_panel = $panel_id;
                     }
                 }
                 /**
                  * Sections
                  */
                 if (isset($skin_option['create_section']) && trim($skin_option['create_section'])) {
                     if (empty($option_id)) {
                         $option_id = sanitize_title(trim($skin_option['create_section']));
                     }
                     $customizer_section = array('id' => $option_id, 'setup' => array('title' => $skin_option['create_section'], 'description' => isset($skin_option['create_section-description']) ? $skin_option['create_section-description'] : '', 'priority' => $priority));
                     if (!isset($skin_option['in_panel'])) {
                         $customizer_panel = '';
                     } else {
                         $customizer_section['setup']['panel'] = $customizer_panel;
                     }
                     $wp_customize->add_section($customizer_section['id'], $customizer_section['setup']);
                     $customizer_section = $customizer_section['id'];
                 }
                 /**
                  * Options
                  *
                  * With add_setting() use a 'type' => 'option' (available: 'option' and 'theme_mod').
                  * Read more at @link  http://wordpress.stackexchange.com/questions/155072/get-option-vs-get-theme-mod-why-is-one-slower
                  */
                 switch ($skin_option['type']) {
                     /**
                      * Background combo options
                      */
                     case 'background':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-color]', array('type' => 'option', 'default' => isset($default['color']) ? $default['color'] : null, 'transport' => $transport, 'sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color'));
                         $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-color]', array('label' => __('Background color', 'mustang'), 'section' => $customizer_section, 'priority' => $priority)));
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-url]', array('type' => 'option', 'default' => isset($default['url']) ? $default['url'] : null, 'transport' => $transport, 'sanitize_callback' => 'wm_sanitize_return_value', 'sanitize_js_callback' => 'wm_sanitize_return_value'));
                         $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-url]', array('label' => __('Background image', 'mustang'), 'section' => $customizer_section, 'priority' => ++$priority, 'context' => WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-url]')));
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-url-hidpi]', array('type' => 'option', 'default' => isset($default['url-hidpi']) ? $default['url-hidpi'] : null, 'transport' => $transport, 'sanitize_callback' => 'wm_sanitize_return_value', 'sanitize_js_callback' => 'wm_sanitize_return_value'));
                         $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-url-hidpi]', array('label' => __('High DPI background image', 'mustang'), 'section' => $customizer_section, 'priority' => ++$priority, 'context' => WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-url-hidpi]', 'active_callback' => 'wm_active_callback_background_image')));
                         if (function_exists('wm_helper_var')) {
                             $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-position]', array('type' => 'option', 'default' => isset($default['position']) ? $default['position'] : '50% 0', 'transport' => $transport, 'sanitize_callback' => 'esc_attr', 'sanitize_js_callback' => 'esc_attr'));
                             $wp_customize->add_control(new WM_Customizer_Radiocustom($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-position]', array('label' => __('Background position', 'mustang'), 'section' => $customizer_section, 'priority' => ++$priority, 'choices' => wm_helper_var('bg-css', 'position'), 'class' => 'matrix', 'active_callback' => 'wm_active_callback_background_image')));
                             $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-repeat]', array('type' => 'option', 'default' => isset($default['repeat']) ? $default['repeat'] : 'no-repeat', 'transport' => $transport, 'sanitize_callback' => 'esc_attr', 'sanitize_js_callback' => 'esc_attr'));
                             $wp_customize->add_control(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-repeat]', array('label' => __('Background repeat', 'mustang'), 'section' => $customizer_section, 'priority' => ++$priority, 'type' => 'select', 'choices' => wm_helper_var('bg-css', 'repeat'), 'active_callback' => 'wm_active_callback_background_image'));
                             $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-attachment]', array('type' => 'option', 'default' => isset($default['attachment']) ? $default['attachment'] : 'scroll', 'transport' => $transport, 'sanitize_callback' => 'esc_attr', 'sanitize_js_callback' => 'esc_attr'));
                             $wp_customize->add_control(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-attachment]', array('label' => __('Background attachment', 'mustang'), 'section' => $customizer_section, 'priority' => ++$priority, 'type' => 'select', 'choices' => wm_helper_var('bg-css', 'scroll'), 'active_callback' => 'wm_active_callback_background_image'));
                             $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-size]', array('type' => 'option', 'default' => isset($default['size']) ? $default['size'] : '', 'transport' => $transport, 'sanitize_callback' => 'esc_attr', 'sanitize_js_callback' => 'esc_attr'));
                             $wp_customize->add_control(WM_THEME_SETTINGS_SKIN . '[' . $option_id . '-bg-size]', array('label' => __('CSS3 background size', 'mustang'), 'section' => $customizer_section, 'priority' => ++$priority, 'type' => 'select', 'choices' => wm_helper_var('bg-css', 'size'), 'active_callback' => 'wm_active_callback_background_image'));
                         }
                         break;
                         /**
                          * Color
                          */
                     /**
                      * Color
                      */
                     case 'color':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color'));
                         $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority)));
                         break;
                         /**
                          * Email
                          *
                          * @since  3.2, WordPress 4.0
                          */
                     /**
                      * Email
                      *
                      * @since  3.2, WordPress 4.0
                      */
                     case 'email':
                         if (wm_check_wp_version(4)) {
                             $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => 'wm_sanitize_email', 'sanitize_js_callback' => 'wm_sanitize_email'));
                             $wp_customize->add_control(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'email', 'label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority));
                         }
                         break;
                         /**
                          * Hidden
                          */
                     /**
                      * Hidden
                      */
                     case 'hidden':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_attr', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_attr'));
                         $wp_customize->add_control(new WM_Customizer_Hidden($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('label' => 'HIDDEN FIELD', 'section' => $customizer_section, 'priority' => $priority)));
                         break;
                         /**
                          * HTML
                          */
                     /**
                      * HTML
                      */
                     case 'html':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[custom-title-' . $priority . ']', array('sanitize_callback' => 'wm_sanitize_return_value', 'sanitize_js_callback' => 'wm_sanitize_return_value'));
                         $wp_customize->add_control(new WM_Customizer_HTML($wp_customize, WM_THEME_SETTINGS_SKIN . '[custom-title-' . $priority . ']', array('label' => $skin_option['content'], 'section' => $customizer_section, 'priority' => $priority)));
                         break;
                         /**
                          * Image
                          */
                     /**
                      * Image
                      */
                     case 'image':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'wm_sanitize_return_value', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'wm_sanitize_return_value'));
                         $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'context' => WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']')));
                         break;
                         /**
                          * Checkbox, radio & select
                          */
                     /**
                      * Checkbox, radio & select
                      */
                     case 'checkbox':
                     case 'radio':
                     case 'select':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_attr', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_attr'));
                         $wp_customize->add_control(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'type' => $skin_option['type'], 'choices' => isset($skin_option['options']) ? $skin_option['options'] : ''));
                         break;
                         /**
                          * Multiselect
                          */
                     /**
                      * Multiselect
                      */
                     case 'multiselect':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'wm_sanitize_return_value', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'wm_sanitize_return_value'));
                         $wp_customize->add_control(new WM_Customizer_Multiselect($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'choices' => isset($skin_option['options']) ? $skin_option['options'] : '')));
                         break;
                         /**
                          * Password
                          *
                          * @since  3.2, WordPress 4.0
                          */
                     /**
                      * Password
                      *
                      * @since  3.2, WordPress 4.0
                      */
                     case 'password':
                         if (wm_check_wp_version(4)) {
                             $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_attr', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_attr'));
                             $wp_customize->add_control(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'password', 'label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority));
                         }
                         break;
                         /**
                          * Radio custom labels
                          */
                     /**
                      * Radio custom labels
                      */
                     case 'radiocustom':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_attr', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_attr'));
                         $wp_customize->add_control(new WM_Customizer_Radiocustom($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'choices' => isset($skin_option['options']) ? $skin_option['options'] : '', 'class' => isset($skin_option['class']) ? $skin_option['class'] : '')));
                         break;
                         /**
                          * Slider
                          *
                          * Since WP4.0 there is also a "range" native input field. This will output
                          * HTML5 <input type="range" /> element - thus still using custom one.
                          */
                     /**
                      * Slider
                      *
                      * Since WP4.0 there is also a "range" native input field. This will output
                      * HTML5 <input type="range" /> element - thus still using custom one.
                      */
                     case 'range':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'wm_sanitize_intval', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'wm_sanitize_intval'));
                         $wp_customize->add_control(new WM_Customizer_Range($wp_customize, WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority, 'json' => array($skin_option['min'], $skin_option['max'], $skin_option['step']))));
                         break;
                         /**
                          * Text
                          */
                     /**
                      * Text
                      */
                     case 'text':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_textarea', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_textarea'));
                         $wp_customize->add_control(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'text', 'label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority));
                         break;
                         /**
                          * Textarea
                          *
                          * Since WordPress 4.0 this is native input field.
                          */
                     /**
                      * Textarea
                      *
                      * Since WordPress 4.0 this is native input field.
                      */
                     case 'textarea':
                         $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_textarea', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_textarea'));
                         $wp_customize->add_control(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'textarea', 'label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority));
                         break;
                         /**
                          * URL
                          *
                          * @since  3.2, WordPress 4.0
                          */
                     /**
                      * URL
                      *
                      * @since  3.2, WordPress 4.0
                      */
                     case 'url':
                         if (wm_check_wp_version(4)) {
                             $wp_customize->add_setting(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'option', 'default' => $default, 'transport' => $transport, 'sanitize_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_url', 'sanitize_js_callback' => isset($skin_option['validate']) ? $skin_option['validate'] : 'esc_url'));
                             $wp_customize->add_control(WM_THEME_SETTINGS_SKIN . '[' . $option_id . ']', array('type' => 'url', 'label' => $skin_option['label'], 'description' => $description, 'section' => $customizer_section, 'priority' => $priority));
                         }
                         break;
                         /**
                          * Default
                          */
                     /**
                      * Default
                      */
                     default:
                         break;
                 }
                 // /switch
             }
             // /if suitable option array
         }
         // /foreach
     }
     // /if skin options are non-empty array
     //Assets needed for customizer preview
     if ($wp_customize->is_preview()) {
         add_action('wp_enqueue_scripts', 'wm_theme_customizer_css');
         add_action('wp_footer', 'wm_theme_customizer_js', 99);
     }
 }
コード例 #4
0
ファイル: setup.php プロジェクト: unisexx/drtooth
		if ( ! wm_option( 'blog-no-format-audio' ) )
			$postFormats[] = 'audio';
		if ( ! wm_option( 'blog-no-format-gallery' ) )
			$postFormats[] = 'gallery';
		if ( ! wm_option( 'blog-no-format-link' ) )
			$postFormats[] = 'link';
		if ( ! wm_option( 'blog-no-format-quote' ) )
			$postFormats[] = 'quote';
		if ( ! wm_option( 'blog-no-format-status' ) )
			$postFormats[] = 'status';
		if ( ! wm_option( 'blog-no-format-video' ) )
			$postFormats[] = 'video';
		if ( ! empty( $postFormats ) )
			add_theme_support( 'post-formats', $postFormats );

		if ( wm_check_wp_version( '3.6' ) )
			add_theme_support( 'structured-post-formats', array( 'audio', 'gallery', 'link', 'quote', 'status', 'video' ) );



	//Feed links
		if ( ! wm_option( 'social-no-auto-feed-link' ) )
			add_theme_support( 'automatic-feed-links' );



	//Custom menus
		add_theme_support( 'menus' );
		//menus array
		$registeredMenusArray = array(
				'main-navigation' => __( 'Main navigation', 'lespaul_domain_adm' ),
コード例 #5
0
ファイル: core.php プロジェクト: unisexx/drtooth
		function wm_password_form() {
			global $post;
			$label     = 'pwbox-' . ( ( empty( $post->ID ) ) ? ( rand() ) : ( $post->ID ) );
			$checkPage = ( wm_check_wp_version( 3.4 ) ) ? ( 'wp-login.php?action=postpass' ) : ( 'wp-pass.php' );
			$out       = '';

			$out = do_shortcode( '[box color="red" icon="warning"]<form class="protected-post-form" action="' . get_option( 'siteurl' ) . '/' . $checkPage . '" method="post"><h4>' . __( 'Enter password to view the content:', 'lespaul_domain' ) . '</h4><p><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" id="submit" value="' . esc_attr__( 'Submit', 'lespaul_domain' ) . '" /></p></form>[/box]' );

			return $out;
		}
コード例 #6
0
ファイル: a-branding.php プロジェクト: unisexx/drtooth
<?php
/*
*****************************************************
* WEBMAN'S WORDPRESS THEME FRAMEWORK
* Created by WebMan - www.webmandesign.eu
*
* WebMan Options Panel - Branding
*****************************************************
*/

$loginLogoFile = ( wm_check_wp_version( '3.2' ) ) ? ( "logo-login.png" ) : ( "logo-login.gif" );
$loginLogoFile = ( wm_check_wp_version( '3.4' ) ) ? ( "wordpress-logo.png" ) : ( $loginLogoFile );

$prefix = 'branding-';

array_push( $options,

array(
	"type" => "section-open",
	"section-id" => "branding",
	"title" => __( 'Branding', 'lespaul_domain_panel' )
),

	array(
		"type" => "sub-tabs",
		"parent-section-id" => "branding",
		"list" => array(
			__( 'Logo, favicon', 'lespaul_domain_panel' ),
			__( 'Login screen', 'lespaul_domain_panel' ),
			__( 'Admin', 'lespaul_domain_panel' ),
			)
コード例 #7
0
ファイル: admin.php プロジェクト: unisexx/drtooth
		function wm_admin_head() {
			global $current_screen, $adminPages;

			$out            = '';
			$noPreviewPosts = array( 'wm_logos', 'wm_modules', 'wm_faq', 'wm_price' );
			if ( ! wm_option( 'cp-staff-rich' ) )
				$noPreviewPosts[] = 'wm_staff';

			//HTML5 tags registration for WordPress 3.2- (just in case)
			if ( ! wm_check_wp_version( '3.3' ) )
				echo '<!--[if lt IE 9]>' . "\r\n" . '<script src="' . WM_ASSETS_THEME . 'js/html5.js" type="text/javascript"></script>' . "\r\n" . '<![endif]-->' . "\r\n";

			//removing unnecessary view buttons
			if ( in_array( $current_screen->post_type, $noPreviewPosts ) )
				$out .= "\r\n" . '.row-actions .view, #view-post-btn, #preview-action {display: none}';

			//WordPress admin bar logo
			if ( wm_option( 'branding-admin-bar-no-logo' ) )
				$out .= '#wp-admin-bar-wp-logo {display: none !important}' . "\r\n";

			//homepage colorize
			if ( 'edit-page' == $current_screen->id )
				$out .= '.hentry.post-' . get_option( 'page_on_front' ) . ' {background: #d7eef4}' . "\r\n" .
					'.hentry.post-' . get_option( 'page_for_posts' ) . ' {background: #d7f4e3}' . "\r\n";
			if ( 'options-reading' == $current_screen->id )
				$out .= '#front-static-pages li + li {margin-top: 15px} #front-static-pages label {padding: 10px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px;}' . "\r\n" .
					'#front-static-pages label[for="page_on_front"] {background: #d7eef4}' . "\r\n" .
					'#front-static-pages label[for="page_for_posts"] {background: #d7f4e3}' . "\r\n";

			//WooCommerce pages colorize
			if ( class_exists( 'Woocommerce' ) && function_exists( 'woocommerce_get_page_id' ) && 'edit-page' == $current_screen->id )
				$out .= '.hentry.post-' . woocommerce_get_page_id( 'myaccount' ) . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'edit_address' )    . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'change_password' ) . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'shop' )            . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'cart' )            . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'checkout' )        . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'pay' )             . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'view_order' )      . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'thanks' )          . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'logout' )          . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'lost_password' )   . ' .check-column {background: #CC99C2}' . "\r\n" .
					'.hentry.post-' . woocommerce_get_page_id( 'terms' )           . ' .check-column {background: #CC99C2}' . "\r\n";

			if ( $out )
				echo '<style type="text/css">' . "\r\n" . $out . '</style>' . "\r\n";
		}