'twitter' ) ); add_settings_field( 'flickr', __( 'Flickr URL', 'academica' ), 'academica_settings_field_flickr', 'theme_options', 'social', array( 'label_for' => 'flickr' ) ); add_settings_field( 'facebook', __( 'Facebook URL', 'academica' ), 'academica_settings_field_facebook', 'theme_options', 'social', array( 'label_for' => 'facebook' ) ); add_settings_field( 'linkedin', __( 'LinkedIn URL', 'academica' ), 'academica_settings_field_linkedin', 'theme_options', 'social', array( 'label_for' => 'linkedin' ) ); add_settings_field( 'youtube', __( 'YouTube URL', 'academica' ), 'academica_settings_field_youtube', 'theme_options', 'social', array( 'label_for' => 'youtube' ) ); } add_action( 'admin_init', 'academica_theme_options_init' ); /** * Change the capability required to save the 'academica_options' options group. * * @see academica_theme_options_init() First parameter to register_setting() is the name of the options group. * @see academica_theme_options_add_page() The edit_theme_options capability is used for viewing the page. * * @param string $capability The capability used for the page, which is manage_options by default. * @return string The capability to actually use. * * @since Academica 1.2.2-wpcom */ function academica_option_page_capability( $capability ) { return 'edit_theme_options'; } add_filter( 'option_page_capability_academica_options', 'academica_option_page_capability' ); /** * Add our theme options page to the admin menu. * * This function is attached to the admin_menu action hook. * * @since Academica 1.2.2-wpcom */ function academica_theme_options_add_page() { $theme_page = add_theme_page( __( 'Theme Options', 'academica' ), // Name of page __( 'Theme Options', 'academica' ), // Label in menu 'edit_theme_options', // Capability required 'theme_options', // Menu slug, used to uniquely identify the page 'academica_theme_options_render_page' // Function that renders the options page ); } add_action( 'admin_menu', 'academica_theme_options_add_page' ); /** * Returns the options object for Academica. * * @since Academica 1.2.2-wpcom */ function academica_get_theme_options() { return (object) wp_parse_args( get_option( 'academica_theme_options', array() ), academica_default_theme_options() ); } /** * Returns the default options array for Academica. * * @since Academica 1.2.2-wpcom */ function academica_default_theme_options() { $defaults = array( 'twitter' => '', 'flickr' => '', 'facebook' => '', 'linkedin' => '', 'youtube' => '', ); return apply_filters( 'academica_default_theme_options', $defaults ); } /** * Echoes the description for the Social settings section. * * @since Academica 1.2.2-wpcom */ function academica_settings_section_social() { _e( 'Add social networking icons to the top of the theme by entering the URLs to your profiles.', 'academica' ); } /** * Renders the Twitter URL setting field. * * @since Academica 1.2.2-wpcom */ function academica_settings_field_twitter() { $options = academica_get_theme_options(); ?>

add_section( 'academica_social_icons', array( 'title' => __( 'Header Social Icons', 'academica' ), 'priority' => 61, // right after Header Image ) ); // Add settings foreach ( array_keys( academica_default_theme_options() ) as $setting ) { $wp_customize->add_setting( "academica_theme_options[{$setting}]", array( 'default' => academica_get_theme_options()->$setting, 'type' => 'option', 'sanitize_callback' => 'esc_url' ) ); } $wp_customize->add_control( 'academica_social_icon_twitter', array( 'label' => __( 'Twitter URL', 'academica' ), 'section' => 'academica_social_icons', 'settings' => 'academica_theme_options[twitter]', 'type' => 'text', ) ); $wp_customize->add_control( 'academica_social_icon_flickr', array( 'label' => __( 'Flickr URL', 'academica' ), 'section' => 'academica_social_icons', 'settings' => 'academica_theme_options[flickr]', 'type' => 'text', ) ); $wp_customize->add_control( 'academica_social_icon_facebook', array( 'label' => __( 'Facebook URL', 'academica' ), 'section' => 'academica_social_icons', 'settings' => 'academica_theme_options[facebook]', 'type' => 'text', ) ); $wp_customize->add_control( 'academica_social_icon_linkedin', array( 'label' => __( 'LinkedIn URL', 'academica' ), 'section' => 'academica_social_icons', 'settings' => 'academica_theme_options[linkedin]', 'type' => 'text', ) ); $wp_customize->add_control( 'academica_social_icon_youtube', array( 'label' => __( 'YouTube URL', 'academica' ), 'section' => 'academica_social_icons', 'settings' => 'academica_theme_options[youtube]', 'type' => 'text', ) ); } add_action( 'customize_register', 'academica_customize_register' );