array( 'name' => 'use_header_logo', 'title' => 'Use Header Logo', 'type' => 'checkbox', 'description' => 'Use a logo image instead of the site name in the header', 'tab' => 'general', 'section' => 'header', 'since' => '1.0', 'default' => false ), 'header_logo' => array( 'name' => 'header_logo', 'title' => 'Header Logo', 'type' => 'file', 'description' => 'Upload a header logo image; maximum image size: 418px by 54px.', 'tab' => 'general', 'section' => 'header', 'since' => '1.0', 'default' => false ), 'facebook_profile' => array( 'name' => 'facebook_profile', 'title' => 'Facebook Profile', 'type' => 'text', 'sanitize' => 'nohtml', 'description' => 'Facebook Username', 'tab' => 'general', 'section' => 'header', 'since' => '1.0', 'default' => '' ), 'twitter_profile' => array( 'name' => 'twitter_profile', 'title' => 'Twitter Profile', 'type' => 'text', 'sanitize' => 'nohtml', 'description' => 'Twitter Username', 'tab' => 'general', 'section' => 'header', 'since' => '1.0', 'default' => '' ), 'youtube_profile' => array( 'name' => 'youtube_profile', 'title' => 'YouTube Profile', 'type' => 'text', 'sanitize' => 'nohtml', 'description' => 'YouTube Username', 'tab' => 'general', 'section' => 'header', 'since' => '1.0', 'default' => '' ), 'frontpage_main_image' => array( 'name' => 'frontpage_main_image', 'title' => 'Image File', 'type' => 'file', 'max_width' => 622, 'max_height' => 444, 'description' => 'Upload an image to be used as the main image on the Front Page; maximum image size: 622px by 444px.', 'tab' => 'general', 'section' => 'frontpagemain', 'since' => '1.0', 'default' => get_template_directory_uri() . '/images/front-page-main.png' ), 'frontpage_main_link' => array( 'name' => 'frontpage_main_link', 'title' => 'Link', 'type' => 'select', 'valid_options' => big_buttons_get_pages(), 'description' => 'Page to link to the Front Page main image', 'tab' => 'general', 'section' => 'frontpagemain', 'since' => '1.0', 'default' => home_url() ), 'frontpage_right_link_color' => array( 'name' => 'frontpage_right_link_color', 'title' => 'Link Color', 'type' => 'text', 'sanitize' => 'hex', 'description' => 'Enter a custom color (HEX value)', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => 'ffffff' ), 'frontpage_right1_image' => array( 'name' => 'frontpage_right1_image', 'title' => 'Image 1 File', 'type' => 'file', 'max_width' => 226, 'max_height' => 128, 'description' => 'Upload an image to be used as the first right-side image on the Front Page; maximum image size: 226px by 128px.', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => get_template_directory_uri() . '/images/front-page-right.png' ), 'frontpage_right1_link' => array( 'name' => 'frontpage_right1_link', 'title' => 'Image 1 Link', 'type' => 'select', 'valid_options' => big_buttons_get_pages(), 'description' => 'Page to link to the first right-side image on the Front Page', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => home_url() ), 'frontpage_right1_linktext' => array( 'name' => 'frontpage_right1_linktext', 'title' => 'Image 1 Link Text', 'type' => 'text', 'sanitize' => 'nohtml', 'description' => 'Link text to display for the first right-side image', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => 'Click Here' ), 'frontpage_right1_teasertext' => array( 'name' => 'frontpage_right1_teasertext', 'title' => 'Image 1 Teaser Text', 'type' => 'text', 'sanitize' => 'nohtml', 'description' => 'Teaser text to display for the first right-side image', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => '' ), 'frontpage_right2_image' => array( 'name' => 'frontpage_right2_image', 'title' => 'Image 2 File', 'type' => 'file', 'max_width' => 226, 'max_height' => 128, 'description' => 'Upload an image to be used as the second right-side image on the Front Page; maximum image size: 226px by 128px.', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => get_template_directory_uri() . '/images/front-page-right.png' ), 'frontpage_right2_link' => array( 'name' => 'frontpage_right2_link', 'title' => 'Image 2 Link', 'type' => 'select', 'valid_options' => big_buttons_get_pages(), 'description' => 'Page to link to the second right-side image on the Front Page', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => home_url() ), 'frontpage_right2_linktext' => array( 'name' => 'frontpage_right2_linktext', 'title' => 'Image 2 Link Text', 'type' => 'text', 'sanitize' => 'nohtml', 'description' => 'Link text to display for the second right-side image', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => 'Click Here' ), 'frontpage_right2_teasertext' => array( 'name' => 'frontpage_right2_teasertext', 'title' => 'Image 2 Teaser Text', 'type' => 'text', 'sanitize' => 'nohtml', 'description' => 'Teaser text to display for the second right-side image', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => '' ), 'frontpage_right3_image' => array( 'name' => 'frontpage_right3_image', 'title' => 'Image 3 File', 'type' => 'file', 'max_width' => 226, 'max_height' => 128, 'description' => 'Upload an image to be used as the third right-side image on the Front Page; maximum image size: 226px by 128px.', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => get_template_directory_uri() . '/images/front-page-right.png' ), 'frontpage_right3_link' => array( 'name' => 'frontpage_right3_link', 'title' => 'Image 3 Link', 'type' => 'select', 'valid_options' => big_buttons_get_pages(), 'description' => 'Page to link to the third right-side image on the Front Page', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => home_url() ), 'frontpage_right3_linktext' => array( 'name' => 'frontpage_right3_linktext', 'title' => 'Image 3 Link Text', 'type' => 'text', 'sanitize' => 'nohtml', 'description' => 'Link text to display for the third right-side image', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => 'Click Here' ), 'frontpage_right3_teasertext' => array( 'name' => 'frontpage_right3_teasertext', 'title' => 'Image 3 Teaser Text', 'type' => 'text', 'sanitize' => 'nohtml', 'description' => 'Teaser text to display for the third right-side image', 'tab' => 'general', 'section' => 'frontpageright', 'since' => '1.0', 'default' => '' ), 'frontpage_bottom1_image' => array( 'name' => 'frontpage_bottom1_image', 'title' => 'Image 1 File', 'type' => 'file', 'max_width' => 284, 'max_height' => 80, 'description' => 'Upload an image to be used as the first bottom image on the Front Page; maximum image size: 284px by 80px.', 'tab' => 'general', 'section' => 'frontpagebottom', 'since' => '1.0', 'default' => get_template_directory_uri() . '/images/front-page-bottom.png' ), 'frontpage_bottom1_link' => array( 'name' => 'frontpage_bottom1_link', 'title' => 'Image 1 Link', 'type' => 'select', 'valid_options' => big_buttons_get_pages(), 'description' => 'Page to link to the first bottom image on the Front Page', 'tab' => 'general', 'section' => 'frontpagebottom', 'since' => '1.0', 'default' => home_url() ), 'frontpage_bottom2_image' => array( 'name' => 'frontpage_bottom2_image', 'title' => 'Image 2 File', 'type' => 'file', 'max_width' => 284, 'max_height' => 80, 'description' => 'Upload an image to be used as the second bottom image on the Front Page; maximum image size: 284px by 80px.', 'tab' => 'general', 'section' => 'frontpagebottom', 'since' => '1.0', 'default' => get_template_directory_uri() . '/images/front-page-bottom.png' ), 'frontpage_bottom2_link' => array( 'name' => 'frontpage_bottom2_link', 'title' => 'Image 2 Link', 'type' => 'select', 'valid_options' => big_buttons_get_pages(), 'description' => 'Page to link to the second bottom image on the Front Page', 'tab' => 'general', 'section' => 'frontpagebottom', 'since' => '1.0', 'default' => home_url() ), 'frontpage_bottom3_image' => array( 'name' => 'frontpage_bottom3_image', 'title' => 'Image 3 File', 'type' => 'file', 'max_width' => 284, 'max_height' => 80, 'description' => 'Upload an image to be used as the third bottom image on the Front Page; maximum image size: 284px by 80px.', 'tab' => 'general', 'section' => 'frontpagebottom', 'since' => '1.0', 'default' => get_template_directory_uri() . '/images/front-page-bottom.png' ), 'frontpage_bottom3_link' => array( 'name' => 'frontpage_bottom3_link', 'title' => 'Image 3 Link', 'type' => 'select', 'valid_options' => big_buttons_get_pages(), 'description' => 'Page to link to the third bottom image on the Front Page', 'tab' => 'general', 'section' => 'frontpagebottom', 'since' => '1.0', 'default' => home_url() ) ); return $options; } /** * Get a list of all Pages * * Array that holds all of the static Pages. */ function big_buttons_get_pages() { $pages = get_pages( array( 'post_type' => 'page', 'post_status' => 'publish' ) ); $pagelist = array(); foreach ( $pages as $thepage ) { $pageid = $thepage->ID; $pagetitle = $thepage->post_title; $pagelist[$pageid] = array( 'name' => $pageid, 'title' => $pagetitle ); } return $pagelist; } /** * Separate settings by tab */ function big_buttons_get_settings_by_tab() { $tabs = big_buttons_get_settings_page_tabs(); $tabnames = array(); foreach ( $tabs as $tab ) { $tabname = $tab['name']; $tabnames[] = $tabname; } $settingsbytab = $tabnames; $default_options = big_buttons_get_default_options(); foreach ( $default_options as $default_option ) { if ( 'internal' != $default_option['type'] ) { $optiontab = $default_option['tab']; $optionname = $default_option['name']; $settingsbytab[$optiontab][] = $optionname; } } return $settingsbytab; } /** * Big Buttons Theme Admin Settings Page Tabs * * Array that holds all of the tabs for the * Big Buttons Theme Settings Page. Each tab * key holds an array that defines the * sections for each tab, including the * description text. */ function big_buttons_get_settings_page_tabs() { $tabs = array( 'general' => array( 'name' => 'general', 'title' => 'General', 'sections' => array( 'header' => array( 'name' => 'header', 'title' =>'Header Options', 'description' => 'Manage Header options for the Big Buttons Theme.' ), 'frontpagemain' => array( 'name' => 'frontpagemain', 'title' => 'Front Page Main Image', 'description' => 'Manage Front Page main image options for the Big Buttons Theme.' ), 'frontpageright' => array( 'name' => 'frontpageright', 'title' => 'Front Page Right-Side Images', 'description' => 'Manage Front Page right-side images options for the Big Buttons Theme.' ), 'frontpagebottom' => array( 'name' => 'frontpagebottom', 'title' => 'Front Page Bottom Images', 'description' => 'Manage Front Page bottom images options for the Big Buttons Theme.' ) ) ) ); return $tabs; } /** * Setup initial Theme options */ function big_buttons_options_init() { // set options equal to defaults global $big_buttons_options; $big_buttons_options = get_option( 'theme_big_buttons_options' ); $default_options = big_buttons_get_default_options(); if ( false === $big_buttons_options ) { $big_buttons_options = array(); foreach ( $default_options as $default_option ) { $optionname = $default_option['name']; $optiondefault = $default_option['default']; $big_buttons_options[$optionname] = $optiondefault; } } $defaults = array(); foreach ( $default_options as $default_option ) { $optionname = $default_option['name']; $optiondefault = $default_option['default']; $defaults[$optionname] = $optiondefault; } $big_buttons_options = array_merge( $defaults, $big_buttons_options ); update_option( 'theme_big_buttons_options', $big_buttons_options ); } // Initialize Theme options add_action('after_setup_theme', 'big_buttons_options_init', 9 ); /** * Enqueue Custom Styles */ function big_buttons_enqueue_style() { $big_buttons_options = get_option( 'theme_big_buttons_options' ); ?> $tabtitle"; else : $links[] = "$tabtitle"; endif; endforeach; echo '

'; echo ''; } /** * Big Buttons Theme Settings Page Markup */ function big_buttons_admin_options_page() { $currenttab = big_buttons_get_current_tab(); $settings_section = 'big_buttons_' . $currenttab . '_tab'; ?>

Theme settings updated successfully.

"; } ?>
false ) ); } else { $upload['url'] = $input[$setting]; } $valid_input[$setting] = $upload['url']; } } } // If reset, reset defaults elseif ( 'reset' == $submittype ) { // Get the array for $setting $option = $default_options[$setting]; // Set $setting to the default value $valid_input[$setting] = $option['default']; } } return $valid_input; } /** * Globalize the variable that holds * the Settings Page tab definitions * * @global array Settings Page Tab definitions */ global $big_buttons_tabs; $big_buttons_tabs = big_buttons_get_settings_page_tabs(); /** * Call add_settings_section() for each Settings * * Loop through each Theme Settings page tab, and add * a new section to the Theme Settings page for each * section specified for each tab. * * @link http://codex.wordpress.org/Function_Reference/add_settings_section Codex Reference: add_settings_section() * * @param string $sectionid Unique Settings API identifier; passed to add_settings_field() call * @param string $title Title of the Settings page section * @param callback $callback Name of the callback function in which section text is output * @param string $pageid Name of the Settings page to which to add the section; passed to do_settings_sections() */ foreach ( $big_buttons_tabs as $tab ) { $tabname = $tab['name']; $tabsections = $tab['sections']; foreach ( $tabsections as $section ) { $sectionname = $section['name']; $sectiontitle = $section['title']; // Add settings section add_settings_section( // $sectionid 'big_buttons_' . $sectionname . '_section', // $title $sectiontitle, // $callback 'big_buttons_sections_callback', // $pageid 'big_buttons_' . $tabname . '_tab' ); } } /** * Callback for add_settings_section() * * Generic callback to output the section text * for each Plugin settings section. * * @param array $section_passed Array passed from add_settings_section() */ function big_buttons_sections_callback( $section_passed ) { global $big_buttons_tabs; $big_buttons_hooks_tabs = big_buttons_get_settings_page_tabs(); foreach ( $big_buttons_tabs as $tab ) { $tabname = $tab['name']; $tabsections = $tab['sections']; foreach ( $tabsections as $section ) { $sectionname = $section['name']; $sectiondescription = $section['description']; $section_callback_id = 'big_buttons_' . $sectionname . '_section'; if ( $section_callback_id == $section_passed['id'] ) { ?>

/> value="" />