function foundation_render_theme_settings($page_options) { wptouch_add_sub_page(FOUNDATION_PAGE_GENERAL, 'foundation-page-theme-settings', $page_options); if (!wptouch_admin_use_customizer()) { if (foundation_has_theme_colors()) { $color_settings = array(); $colors = foundation_get_theme_colors(); foreach ($colors as $name => $color) { $color_settings[] = wptouch_add_setting('color', $color->setting, $color->desc, '', WPTOUCH_SETTING_BASIC, '1.0', '', $color->domain); } wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Theme Colors', 'wptouch-pro'), 'foundation-colors', $color_settings, $page_options, FOUNDATION_SETTING_DOMAIN, false, false, 20); } } $foundation_blog_settings = array(wptouch_add_pro_setting('range', 'posts_per_page', __('Number of posts in post listings', 'wptouch-pro'), __('Overrides the WordPress Reading settings for "Blog pages show at most"', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0', array('min' => 1, 'max' => 15, 'step' => 1)), wptouch_add_pro_setting('text', 'excluded_categories', __('Excluded categories', 'wptouch-pro'), __('Comma separated by category name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0'), wptouch_add_pro_setting('text', 'excluded_tags', __('Excluded tags', 'wptouch-pro'), __('Comma separated by tag name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0')); $foundation_blog_settings = apply_filters('foundation_settings_blog', $foundation_blog_settings); $foundation_page_settings = apply_filters('foundation_settings_page', array()); wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Blog', 'wptouch-pro'), 'foundation-web-theme-settings', $foundation_blog_settings, $page_options, FOUNDATION_SETTING_DOMAIN, true); wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Pages', 'wptouch-pro'), 'foundation-page-settings', $foundation_page_settings, $page_options, FOUNDATION_SETTING_DOMAIN, true); if (!function_exists('has_site_icon')) { wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Site Icon', 'wptouch-pro'), 'admin_menu_homescreen_android', array(wptouch_add_setting('image-upload', 'iphone_icon_retina', sprintf(__('%d by %d pixels (PNG)', 'wptouch-pro'), 192, 192), false, WPTOUCH_SETTING_BASIC, '2.0')), $page_options, FOUNDATION_SETTING_DOMAIN, true, false, 30); } $foundation_header_settings = array(wptouch_add_setting('image-upload', 'logo_image', __('Site Logo', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, false, '1.0')); $foundation_header_settings = apply_filters('foundation_settings_header', $foundation_header_settings); wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Header', 'wptouch-pro'), 'foundation-header', $foundation_header_settings, $page_options, FOUNDATION_SETTING_DOMAIN, true, false, 10); wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Footer', 'wptouch-pro'), 'foundation-custom-content', array(wptouch_add_setting('textarea', 'custom_footer_message', __('Custom footer content (HTML is allowed)', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '1.0')), $page_options, FOUNDATION_SETTING_DOMAIN, true, false, 70); wptouch_add_page_section(FOUNDATION_PAGE_BRANDING, __('Custom CSS', 'wptouch-pro'), 'foundation-custom-css-declarations', array(wptouch_add_setting('textarea', 'custom_css_declarations', __('Custom CSS Declarations', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '4.0')), $page_options, FOUNDATION_SETTING_DOMAIN, true, false, 80); return $page_options; }
wptouch_multisite_page_classes('themes'); ?> foundation-page-theme-settings<?php if (isset($_COOKIE['wptouch-4-admin-menu']) && $_COOKIE['wptouch-4-admin-menu'] == 'foundation-page-theme-settings') { echo ' active'; } ?> " data-page-slug="foundation-page-theme-settings"><?php _e('Theme Settings', 'wptouch-pro'); ?> </a></li> <?php } ?> <?php if (wptouch_admin_use_customizer()) { ?> <li><a href="#" class="<?php wptouch_multisite_page_classes('themes'); ?> foundation-page-theme-customizer<?php if (isset($_COOKIE['wptouch-4-admin-menu']) && $_COOKIE['wptouch-4-admin-menu'] == 'foundation-page-theme-customizer') { echo ' active'; } ?> " data-page-slug="foundation-page-theme-customizer"><?php _e('Customize Theme', 'wptouch-pro'); ?> </a></li> <?php }
<?php global $wptouch_pro; $current_theme = $wptouch_pro->get_current_theme_info(); if ($current_theme && wptouch_admin_use_customizer()) { add_action('admin_init', 'wptouch_initialize_customizer'); // Executed during the Customizer parent window load. add_action('customize_register', 'wptouch_customizer_setup', 5); // Executed during the Customizer child window load (preview). add_action('customize_controls_enqueue_scripts', 'wptouch_customizer_scripts'); // Executed when a new setting is detected and its default value is merged into the settings object add_action('wptouch_settings_after_merge_default', 'wptouch_customizer_merge_setting', 10, 3); // Executed after settings backup is loaded, replacing WPtouch settings. add_action('wptouch_after_restore_settings', 'wptouch_customizer_restore_settings', 10, 2); // Executed after settings have been erased. add_action('wptouch_after_reset_settings', 'wptouch_customizer_reset_settings'); add_action('wptouch_after_self_destruct', 'wptouch_customizer_reset_settings'); add_filter('wptouch_force_mobile_device', 'wptouch_is_customizing_mobile'); // If we're in the customizer and we're editing the mobile theme... if (wptouch_is_customizing_mobile()) { add_filter('customize_previewable_devices', '__return_empty_array'); add_filter('validate_current_theme', 'wptouch_return_false'); add_filter('wptouch_show_mobile_switch_link', 'wptouch_return_false'); add_action('customize_register', 'wptouch_customizer_remove_undesired_sections', 5); add_action('customize_register', 'wptouch_customizer_remove_desktop_sections', 999); // Force WPtouch to handle this as a mobile request add_filter('wptouch_user_agent', 'customizer_user_override'); // Make WordPress aware we're using the mobile theme not the desktop theme (not overriden by WPtouch) add_filter('pre_option_stylesheet', 'wptouch_get_current_theme_name', 50); add_filter('pre_option_template', 'wptouch_get_current_theme_friendly_name', 50); // Prevent the 'custom landing page' setting from being applied.
function _wptouch_add_setting($type, $name, $desc = '', $tooltip = '', $level = WPTOUCH_SETTING_BASIC, $version = false, $extra = false, $domain = '', $is_pro = false, $prefix = false) { $setting = new stdClass(); if ($type == 'radiolist' || $type == 'radio') { $type = 'list'; } if (!wptouch_admin_use_customizer() && $type == 'select') { $type = 'list'; } if (!wptouch_admin_use_customizer() && $type == 'range') { $type = 'text'; } if (!wptouch_admin_use_customizer() && $type == 'url') { $type = 'text'; } $setting->type = $type; $setting->name = $name; $setting->desc = $desc; $setting->level = $level; $setting->tooltip = $tooltip; $setting->version = $version; $setting->extra = $extra; $setting->domain = $domain; $setting->is_pro = $is_pro; return $setting; }