function define_customizer_fields($wp_customize) { // Home Page Features $wp_customize->add_setting('homepage_title'); $wp_customize->add_control('homepage_title', array('type' => 'text', 'label' => 'Home Page Title', 'description' => 'The title that will appear above the text on the home page.', 'section' => THEME_CUSTOMIZER_PREFIX . 'homepage')); $wp_customize->add_setting('homepage_content'); $wp_customize->add_control('homepage_content', array('type' => 'textarea', 'label' => 'Home Page Content', 'description' => 'The text that will appear on the home page.', 'section' => THEME_CUSTOMIZER_PREFIX . 'homepage')); // Header $wp_customize->add_setting('header_image'); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'header_image', array('label' => __('Header Image'), 'description' => __('The image that will appear in the header on every page'), 'section' => THEME_CUSTOMIZER_PREFIX . 'header', 'settings' => 'header_image'))); // Footer $wp_customize->add_setting('footer_address', array('default' => get_setting_default('footer_address'))); $wp_customize->add_control('footer_address', array('type' => 'textarea', 'label' => 'Footer Address', 'description' => 'Defines the address in the footer', 'section' => THEME_CUSTOMIZER_PREFIX . 'footer')); $wp_customize->add_setting('footer_phone', array('default' => get_setting_default('footer_phone'))); $wp_customize->add_control('footer_phone', array('type' => 'text', 'label' => 'Footer Phone', 'description' => 'Defines the phone in the footer', 'section' => THEME_CUSTOMIZER_PREFIX . 'footer')); $wp_customize->add_setting('footer_contact_page'); $wp_customize->add_control('footer_contact_page', array('type' => 'dropdown-pages', 'label' => 'Footer Contact Page', 'description' => 'Defines the contact page link in the footer', 'section' => THEME_CUSTOMIZER_PREFIX . 'footer')); $wp_customize->add_setting('footer_menu', array('default' => 'social-menu')); $wp_customize->add_control('footer_menu', array('type' => 'select', 'label' => __('Footer Menu'), 'description' => __('Defines the menu to use in the footer.'), 'section' => THEME_CUSTOMIZER_PREFIX . 'footer', 'choices' => array('header-menu' => __('Header Menu'), 'footer-menu' => __('Footer Menu'), 'social-menu' => __('Social Menu')))); // Social $wp_customize->add_setting('googleplus_url'); $wp_customize->add_control('googleplus_url', array('type' => 'url', 'label' => __('Google+ Url'), 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('twitter_url'); $wp_customize->add_control('twitter_url', array('type' => 'url', 'label' => __('Twitter Url'), 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('facebook_url'); $wp_customize->add_control('facebook_url', array('type' => 'url', 'label' => __('Facebook Url'), 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('instagram_url'); $wp_customize->add_control('instagram_url', array('type' => 'url', 'label' => __('Instagram Url'), 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('youtube_url'); $wp_customize->add_control('youtube_url', array('type' => 'url', 'label' => __('YouTube Url'), 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); }
/** * Register Customizer Controls and Settings here. * * Any new settings should be registered here with type 'theme_mod' (and NOT * 'option'/do not use an array key structure for ID names). **/ function define_customizer_fields($wp_customize) { // Home $wp_customize->add_setting('weather_feed_url', array('default' => get_setting_default('weather_feed_url'))); $wp_customize->add_control('weather_feed_url', array('type' => 'text', 'label' => 'Weather Feed URL', 'description' => 'The url of the CM Weather Feed', 'section' => THEME_CUSTOMIZER_PREFIX . 'home_custom')); $form_choices = array('' => '-- Choose Form --'); if (method_exists('RGFormsModel', 'get_forms')) { $forms = RGFormsModel::get_forms(null, 'title'); foreach ($forms as $form) { $form_choices[$form->id] = $form->title; } } $wp_customize->add_setting('footer_contact_form'); $wp_customize->add_control('footer_contact_form', array('type' => 'select', 'label' => 'Footer Contact Form', 'description' => 'The form that will be shown in the footer.', 'section' => THEME_CUSTOMIZER_PREFIX . 'home_custom', 'choices' => $form_choices)); // Menus $wp_customize->add_setting('header_menu_feed', array('default' => get_setting_default('header_menu_feed'))); $wp_customize->add_control('header_menu_feed', array('type' => 'text', 'label' => 'Header Menu Feed', 'description' => 'The JSON feed of the www.ucf.edu header menu.', 'section' => THEME_CUSTOMIZER_PREFIX . 'remote_menus')); $wp_customize->add_setting('footer_menu_feed'); $wp_customize->add_control('footer_menu_feed', array('type' => 'text', 'label' => 'Footer Menu Feed', 'description' => 'The JSON feed of the www.ucf.edu footer menu.', 'section' => THEME_CUSTOMIZER_PREFIX . 'remote_menus')); // Analytics $wp_customize->add_setting('gw_verify'); $wp_customize->add_control('gw_verify', array('type' => 'text', 'label' => 'Google WebMaster Verification', 'description' => 'Example: <em>9Wsa3fspoaoRE8zx8COo48-GCMdi5Kd-1qFpQTTXSIw</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'analytics')); $wp_customize->add_setting('ga_account'); $wp_customize->add_control('ga_account', array('type' => 'text', 'label' => 'Google Analytics Account', 'description' => 'Example: <em>UA-9876543-21</em>. Leave blank for development.', 'section' => THEME_CUSTOMIZER_PREFIX . 'analytics')); $wp_customize->add_setting('gtm_id'); $wp_customize->add_control('gtm_id', array('type' => 'text', 'label' => 'Google Tag Manager ID', 'description' => 'Example: <em>MTG-ABC123</em>. Leave blank for development.', 'section' => THEME_CUSTOMIZER_PREFIX . 'analytics')); // Events $wp_customize->add_setting('events_max_items', array('default' => get_setting_default('events_max_items'))); $wp_customize->add_control('events_max_items', array('type' => 'select', 'label' => 'Events Max Items', 'description' => 'Maximum number of events to display when outputting event information.', 'section' => THEME_CUSTOMIZER_PREFIX . 'events', 'choices' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5))); $wp_customize->add_setting('events_url', array('default' => get_setting_default('events_url'))); $wp_customize->add_control('events_url', array('type' => 'text', 'label' => 'Events Calendar URL', 'description' => 'Base URL for the calendar you wish to use. Example: <em>http://events.ucf.edu/mycalendar</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'events')); $wp_customize->add_setting('academic_calendar_feed_url', array('default' => get_setting_default('academic_calendar_feed_url'))); $wp_customize->add_control('academic_calendar_feed_url', array('type' => 'text', 'label' => 'Academic Calendar Feed URL', 'description' => 'Base URL for the calendar feed you wish to use. Example: <em>http://calendar.ucf.edu/json/2016/spring</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'academic_calendar')); $wp_customize->add_setting('academic_calendar_full_url', array('default' => get_setting_default('academic_calendar_full_url'))); $wp_customize->add_control('academic_calendar_full_url', array('type' => 'text', 'label' => 'Academic Calendar URL', 'description' => 'Base URL for the calendar you wish to use. Example: <em>http://calendar.ucf.edu/</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'academic_calendar')); // Org Info $wp_customize->add_setting('organization_name'); $wp_customize->add_control('organization_name', array('type' => 'text', 'label' => 'Oragnization Name', 'description' => 'The name that will be displayed with organization info is displayed', 'section' => THEME_CUSTOMIZER_PREFIX . 'org_info')); $wp_customize->add_setting('organization_phone'); $wp_customize->add_control('organization_phone', array('type' => 'text', 'label' => 'Oragnization Phone', 'description' => 'The phone number that will be displayed with organization info is displayed', 'section' => THEME_CUSTOMIZER_PREFIX . 'org_info')); $wp_customize->add_setting('organization_email'); $wp_customize->add_control('organization_email', array('type' => 'email', 'label' => 'Oragnization Email', 'description' => 'The email address that will be displayed with organization info is displayed', 'section' => THEME_CUSTOMIZER_PREFIX . 'org_info')); // News $wp_customize->add_setting('news_max_items', array('default' => get_setting_default('news_max_items'))); $wp_customize->add_control('news_max_items', array('type' => 'select', 'label' => 'News Max Items', 'description' => 'Maximum number of articles to display when outputting news information.', 'section' => THEME_CUSTOMIZER_PREFIX . 'news', 'choices' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5))); $wp_customize->add_setting('news_url', array('default' => get_setting_default('news_url'))); $wp_customize->add_control('news_url', array('type' => 'text', 'label' => 'News Feed', 'description' => 'Use the following URL for the news RSS feed <br>Example: <em>http://today.ucf.edu/feed/</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'news')); $wp_customize->add_setting('news_placeholder_image'); $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'news_placeholder_image', array('label' => __('Placeholder thumbnail for news stories.'), 'section' => THEME_CUSTOMIZER_PREFIX . 'news'))); // Search $wp_customize->add_setting('enable_google', array('default' => get_setting_default('enable_google'))); $wp_customize->add_control('enable_google', array('type' => 'checkbox', 'label' => 'Enable Google Search', 'description' => 'Enable to use the google search appliance to power the search functionality.', 'section' => THEME_CUSTOMIZER_PREFIX . 'search')); $wp_customize->add_setting('search_domain'); $wp_customize->add_control('search_domain', array('type' => 'text', 'label' => 'Search Domain', 'description' => 'Domain to use for the built-in google search. Useful for development or if the site needs to search a domain other than the one it occupies. Example: <em>some.domain.com</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'search')); $wp_customize->add_setting('search_per_page', array('default' => get_setting_default('search_per_page'), 'type' => 'option')); $wp_customize->add_control('search_per_page', array('type' => 'number', 'label' => 'Search Results Per Page', 'description' => 'Number of search results to show per page of results', 'section' => THEME_CUSTOMIZER_PREFIX . 'search', 'input_attrs' => array('min' => 1, 'max' => 50, 'step' => 1))); $wp_customize->add_setting('map_search_url', array('default' => get_setting_default('map_search_url'))); $wp_customize->add_control('map_search_url', array('type' => 'text', 'label' => 'Campus Map Domain', 'description' => 'Domain to use for the "Search Student Services on Campus" search at the bottom of the home page.', 'section' => THEME_CUSTOMIZER_PREFIX . 'home_custom')); // Social Media $wp_customize->add_setting('facebook_url'); $wp_customize->add_control('facebook_url', array('type' => 'url', 'label' => 'Facebook URL', 'description' => 'URL to the Facebook page you would like to direct visitors to. Example: <em>https://www.facebook.com/UCF</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('twitter_url'); $wp_customize->add_control('twitter_url', array('type' => 'url', 'label' => 'Twitter URL', 'description' => 'URL to the Twitter user account you would like to direct visitors to. Example: <em>http://twitter.com/UCF</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('googleplus_url'); $wp_customize->add_control('googleplus_url', array('type' => 'url', 'label' => 'Google+ URL', 'description' => 'URL to the Google+ user account you would like to direct visitors to. Example: <em>http://plus.google.com/UCF</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('linkedin_url'); $wp_customize->add_control('linkedin_url', array('type' => 'url', 'label' => 'LinkedIn URL', 'description' => 'URL to the LinkedIn user account you would like to direct visitors to. Example: <em>http://linkedin.com/UCF</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('instagram_url'); $wp_customize->add_control('instagram_url', array('type' => 'url', 'label' => 'Instagram URL', 'description' => 'URL to the Instagram user account you would like to direct visitors to. Example: <em>http://instagram.com/UCF</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('pinterest_url'); $wp_customize->add_control('pinterest_url', array('type' => 'url', 'label' => 'Pinterest URL', 'description' => 'URL to the Pinterest user account you would like to direct visitors to. Example: <em>http://pinterest.com/UCF</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('youtube_url'); $wp_customize->add_control('youtube_url', array('type' => 'url', 'label' => 'YouTube URL', 'description' => 'URL to the YouTube user account you would like to direct visitors to. Example: <em>http://youtube.com/UCF</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); // Web Fonts $wp_customize->add_setting('cloud_typography_key', array('default' => get_setting_default('cloud_typography_key'))); $wp_customize->add_control('cloud_typography_key', array('type' => 'text', 'label' => 'Cloud.Typography CSS Key URL', 'description' => 'The CSS Key provided by Cloud.Typography for this project. <strong>Only include the value in the "href" portion of the link tag provided; e.g. "//cloud.typography.com/000000/000000/css/fonts.css".</strong><br><br>NOTE: Make sure the Cloud.Typography project has been configured to deliver fonts to this site\'s domain.<br> See the <a target="_blank" href="http://www.typography.com/cloud/user-guide/managing-domains">Cloud.Typography docs on managing domains</a> for more info.', 'section' => THEME_CUSTOMIZER_PREFIX . 'webfonts')); /** * If Yoast SEO is activated, assume we're handling ALL SEO-related * modifications with it. Don't add Facebook Opengraph theme options. **/ if (!is_plugin_active('wordpress-seo/wp-seo.php')) { $wp_customize->add_setting('enable_og', array('default' => 1)); $wp_customize->add_control('enable_og', array('type' => 'checkbox', 'label' => 'Enable Opengraph', 'description' => 'Turn on the Opengraph meta information used by Facebook.', 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); $wp_customize->add_setting('fb_admins'); $wp_customize->add_control('fb_admins', array('type' => 'textarea', 'label' => 'Facebook Admins', 'description' => 'Comma separated facebook usernames or user ids of those responsible for administrating any facebook pages created from pages on this site. Example: <em>592952074, abe.lincoln</em>', 'section' => THEME_CUSTOMIZER_PREFIX . 'social')); } }
function get_theme_mod_or_default($mod, $fallback = '') { return get_theme_mod($mod, get_setting_default($mod, $fallback)); }