function inti_initialize_general_options() { // If the theme options don't exist, create them. if (false == get_option('inti_general_options')) { add_option('inti_general_options', apply_filters('inti_default_general_options', inti_default_general_options())); } // end if // First, we register a section. This is necessary since all future options must belong to a add_settings_section('general_settings_section', __('Posts and Pages', 'inti'), 'inti_posts_and_pages_callback', 'inti_general_options'); // Next, we'll introduce the fields for toggling the visibility of content elements. add_settings_field('excerpt_limit', __('Excerpt Limit', 'inti'), 'inti_excerpt_limit_callback', 'inti_general_options', 'general_settings_section', array(__('How many characters do you want to display for excerpts?', 'inti'))); add_settings_field('read_more_text', __('Read More text', 'inti'), 'inti_read_more_text_callback', 'inti_general_options', 'general_settings_section', array(__('After the excerpt there\'s a button or link with this text to continue reading.', 'inti'))); add_settings_field('blog_interface', __('Blog Index Style', 'inti'), 'inti_blog_interface_callback', 'inti_general_options', 'general_settings_section', array(__('You can display posts in a classic blog style as in option one, or shorts style as in option two.', 'inti'))); add_settings_field('breadcrumbs', __('Show Breadcrumbs', 'inti'), 'inti_breadcrumbs_callback', 'inti_general_options', 'general_settings_section', array(__('They can be displayed before and after the content, or not at all.', 'inti'))); add_settings_field('pagination', __('Pagination Style', 'inti'), 'inti_pagination_callback', 'inti_general_options', 'general_settings_section', array(__('Move between lists of posts in archives with number or Next/Previous links', 'inti'))); add_settings_field('nextprev_post_links', __('Links to Next/Previous posts on single posts', 'inti'), 'inti_nextprev_post_links_callback', 'inti_general_options', 'general_settings_section', array(__('Move from one post to the next or previous post directly with Next/Previous links', 'inti'))); add_settings_section('general_settings_section_2', __('Front Page', 'inti'), 'inti_frontpage_callback', 'inti_general_options'); add_settings_field('frontpage_post_category', __('Post Category to display', 'inti'), 'inti_frontpage_post_category_callback', 'inti_general_options', 'general_settings_section_2'); add_settings_field('frontpage_post_number', __('Number of posts to display', 'inti'), 'inti_frontpage_post_number_callback', 'inti_general_options', 'general_settings_section_2'); add_settings_field('frontpage_post_columns', __('Number of columns', 'inti'), 'inti_frontpage_post_columns_callback', 'inti_general_options', 'general_settings_section_2'); add_settings_field('frontpage_exclude_category', __('Exclude front page category', 'inti'), 'inti_frontpage_exclude_category_callback', 'inti_general_options', 'general_settings_section_2'); add_settings_field('frontpage_breadcrumbs', __('Hide breadcrumbs on front page', 'inti'), 'inti_frontpage_breadcrumbs_callback', 'inti_general_options', 'general_settings_section_2'); add_settings_section('general_settings_section_3', __('Sharing', 'inti'), 'inti_sharing_callback', 'inti_general_options'); add_settings_field('sharing_on_posts', __('Enable sharing on Posts', 'inti'), 'inti_sharing_posts_callback', 'inti_general_options', 'general_settings_section_3'); add_settings_field('sharing_on_pages', __('Enable sharing on Pages', 'inti'), 'inti_sharing_pages_callback', 'inti_general_options', 'general_settings_section_3'); add_settings_field('sharing_platforms', __('Display these sharing platforms', 'inti'), 'inti_sharing_platforms_callback', 'inti_general_options', 'general_settings_section_3', array('options' => array('twitter' => 'Twitter', 'facebook' => 'Facebook', 'google' => 'Google+', 'linkedin' => 'LinkedIn', 'pinterest' => 'Pinterest', 'tumblr' => 'Tumblr'))); add_settings_section('general_settings_section_4', __('404', 'inti'), 'inti_404_callback', 'inti_general_options'); add_settings_field('page_not_found', __('Message to display when page not found', 'inti'), 'inti_page_not_found_callback', 'inti_general_options', 'general_settings_section_4', array('')); // Finally, we register the fields with WordPress register_setting('inti_general_options', 'inti_general_options'); }
/** * Initializes the theme's general options page by registering the Sections, * Fields, and Settings. * * The overrides the plugable funtion found in the parent theme * We have this here because we want to remove any front page options from the General page/tab */ function inti_initialize_general_options() { // If the theme options don't exist, create them. if (false == get_option('inti_general_options')) { add_option('inti_general_options', apply_filters('inti_default_general_options', inti_default_general_options())); } // end if // First, we register a section. This is necessary since all future options must belong to a add_settings_section('general_settings_section', __('Posts and Pages', 'inti'), 'inti_posts_and_pages_callback', 'inti_general_options'); // Next, we'll introduce the fields for toggling the visibility of content elements. add_settings_field('excerpt_limit', __('Excerpt Limit', 'inti'), 'inti_excerpt_limit_callback', 'inti_general_options', 'general_settings_section', array(__('How many characters do you want to display for excerpts?', 'inti'))); add_settings_field('read_more_text', __('Read More text', 'inti'), 'inti_read_more_text_callback', 'inti_general_options', 'general_settings_section', array(__('After the excerpt there\'s a button or link with this text to continue reading.', 'inti'))); add_settings_field('blog_interface', __('Blog Index Style', 'inti'), 'inti_blog_interface_callback', 'inti_general_options', 'general_settings_section', array(__('You can display posts in a classic blog style as in option one, or shorts style as in option two.', 'inti'))); add_settings_field('breadcrumbs', __('Show Breadcrumbs', 'inti'), 'inti_breadcrumbs_callback', 'inti_general_options', 'general_settings_section', array(__('They can be displayed before and after the content, or not at all.', 'inti'))); add_settings_field('frontpage_breadcrumbs', __('Hide breadcrumbs on front page', 'inti'), 'inti_frontpage_breadcrumbs_callback', 'inti_general_options', 'general_settings_section'); add_settings_field('pagination', __('Pagination Style', 'inti'), 'inti_pagination_callback', 'inti_general_options', 'general_settings_section', array(__('Move between lists of posts in archives with number or Next/Previous links', 'inti'))); add_settings_field('nextprev_post_links', __('Links to Next/Previous posts on single posts', 'inti'), 'inti_nextprev_post_links_callback', 'inti_general_options', 'general_settings_section', array(__('Move from one post to the next or previous post directly with Next/Previous links', 'inti'))); /** * We're removing the front page options from general, because they'll now go in Customizer along with all the other front page blocks * @see framework/custimizer/child-customize.php */ // add_settings_section( // 'general_settings_section_2', // ID used to identify this section and with which to register options // __( 'Front Page', 'inti' ), // Title to be displayed on the administration page // 'inti_frontpage_callback', // Callback used to render the description of the section // 'inti_general_options' // Page on which to add this section of options // ); // add_settings_field( // 'frontpage_post_category', // ID used to identify the field throughout the theme // __( 'Post Category to display', 'inti' ), // The label to the left of the option interface element // 'inti_frontpage_post_category_callback', // The name of the function responsible for rendering the option interface // 'inti_general_options', // The page on which this option will be displayed // 'general_settings_section_2' // ); // add_settings_field( // 'frontpage_post_number', // ID used to identify the field throughout the theme // __( 'Number of posts to display', 'inti' ), // The label to the left of the option interface element // 'inti_frontpage_post_number_callback', // The name of the function responsible for rendering the option interface // 'inti_general_options', // The page on which this option will be displayed // 'general_settings_section_2' // ); // add_settings_field( // 'frontpage_post_columns', // ID used to identify the field throughout the theme // __( 'Number of columns', 'inti' ), // The label to the left of the option interface element // 'inti_frontpage_post_columns_callback', // The name of the function responsible for rendering the option interface // 'inti_general_options', // The page on which this option will be displayed // 'general_settings_section_2' // ); // add_settings_field( // 'frontpage_exclude_category', // ID used to identify the field throughout the theme // __( 'Exclude front page category', 'inti' ), // The label to the left of the option interface element // 'inti_frontpage_exclude_category_callback', // The name of the function responsible for rendering the option interface // 'inti_general_options', // The page on which this option will be displayed // 'general_settings_section_2' // ); add_settings_section('general_settings_section_3', __('Sharing', 'inti'), 'inti_sharing_callback', 'inti_general_options'); add_settings_field('sharing_on_posts', __('Enable sharing on Posts', 'inti'), 'inti_sharing_posts_callback', 'inti_general_options', 'general_settings_section_3'); add_settings_field('sharing_on_pages', __('Enable sharing on Pages', 'inti'), 'inti_sharing_pages_callback', 'inti_general_options', 'general_settings_section_3'); add_settings_field('sharing_platforms', __('Display these sharing platforms', 'inti'), 'inti_sharing_platforms_callback', 'inti_general_options', 'general_settings_section_3', array('options' => array('twitter' => 'Twitter', 'facebook' => 'Facebook', 'google' => 'Google+', 'linkedin' => 'LinkedIn', 'pinterest' => 'Pinterest', 'tumblr' => 'Tumblr'))); add_settings_section('general_settings_section_4', __('404', 'inti'), 'inti_404_callback', 'inti_general_options'); add_settings_field('page_not_found', __('Message to display when page not found', 'inti'), 'inti_page_not_found_callback', 'inti_general_options', 'general_settings_section_4', array('')); // Finally, we register the fields with WordPress register_setting('inti_general_options', 'inti_general_options'); }