'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(); ?>