Header ', 'sm_section_open', $page ); add_settings_field( 'header_logo', 'Custom Logo', 'sm_field_upload', $page, $section, array('header_logo', 'Size: 164px x 62px' ) ); add_settings_section( $section.'_close', '', 'sm_section_close', $page ); // ****** Section Slider $section = $page.'_slider'; $options = get_option( 'plugin_options' ); $total_slides = $options['slider_total_slides']; $slider_caption = $options['slider_caption']; $slider_anchor = $options['slider_anchor']; add_settings_section( $section, ' Slider ', 'sm_section_slider_open', $page ); add_settings_field( 'slider_total_slides', 'Number of Slides', 'sm_field_dropdown', $page, $section, array( 'slider_total_slides', array( 1,2,3,4,5,6,7,8,9,10 ), 'Select the total number of slides.' ) ); add_settings_field( 'slider_pause_time', 'Slider Pause Time', 'sm_field_dropdown', $page, $section, array( 'slider_pause_time', array( 1000,2000,3000,4000,5000,6000,7000,8000,9000,10000 ), 'Select the pause time(milliseconds) between slides.' ) ); add_settings_field( 'slider_anchor', 'Enable Anchor Link', 'sm_field_checkbox', $page, $section, array( 'slider_anchor', 'Enable anchor links wrapping individual slides.' ) ); add_settings_field( 'slider_caption', 'Enable Caption Text', 'sm_field_checkbox', $page, $section, array( 'slider_caption', 'Enable caption text for individual slides.' ) ); add_settings_field( 'slider_transition', 'Transition Effect', 'sm_field_dropdown', $page, $section, array( 'slider_transition', array( 'sliceDownRight', 'sliceDownLeft', 'sliceUpRight', 'sliceUpLeft', 'sliceUpDown', 'sliceUpDownLeft', 'fold', 'fade', 'boxRandom', 'boxRain', 'boxRainReverse', 'boxRainGrow', 'boxRainGrowReverse' ), 'Select slides transition effect.' ) ); // Dynamic Slider Images & Captions Fields $numbers = array( 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten' ); $label = array( '1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th' ); $i = 0; foreach ( $numbers as $number ) : if ( $i < $total_slides ) : // Slider Images add_settings_field( 'slider_image_'.$number, $label[$i].' Slide', 'sm_field_upload', $page, $section, array( "slider_image_$number" ) ); // Slider Anchor Links if ( $slider_anchor == '1' ) { add_settings_field( 'slider_anchor_'.$number, $label[$i].' Anchor Link', 'sm_field_text_medium', $page, $section, array( "slider_anchor_$number", 'Enter Absolute URL. E.g http://www.example.com' ) ); } // Slider Caption if ( $slider_caption == '1' ) { add_settings_field( 'slider_caption_'.$number, $label[$i].' Caption', 'sm_field_text_large', $page, $section, array( "slider_caption_$number", 'A brief text describing the slide.' ) ); } endif; $i++; endforeach; add_settings_section( $section.'_close', '', 'sm_section_close', $page ); // ****** Section Footer $section = $page.'_footer'; add_settings_section( $section, ' Footer ', 'sm_section_open', $page ); add_settings_field( 'footer_ga_code', 'Google Analytics Code', 'sm_field_textarea', $page, $section, array( 'footer_ga_code' ) ); add_settings_section( $section.'_close', '', 'sm_section_close', $page ); // ******************* Page Typography ******************* $page = 'typography'; // ****** Section Body $section = $page.'_body'; add_settings_section( $section, ' Body ', 'sm_section_open', $page ); add_settings_field( 'body_font_size', 'Font Size (px)', 'sm_field_text_small', $page, $section, array( 'body_font_size' ) ); add_settings_field( 'body_font_color', 'Font Color', 'sm_field_color_picker', $page, $section, array('body_font_color', 'body_font_color_picker' ) ); add_settings_field( 'body_line_height', 'Line Height', 'sm_field_text_small', $page, $section, array('body_line_height' ) ); add_settings_field( 'body_font_family', 'Font Family', 'sm_field_text_medium', $page, $section, array( 'body_font_family', 'Comma Seperated Fonts (Arial, Helvetica, sans-serif)' ) ); add_settings_section( $section.'_close', '', 'sm_section_close', $page ); // ****** Section Anchor Links $section = $page.'_anchor'; add_settings_section( $section, ' Anchor Link ', 'sm_section_open', $page ); add_settings_field( 'anchor_color', 'Link Color', 'sm_field_color_picker', $page, $section, array('anchor_color', 'anchor_color_picker' ) ); add_settings_field( 'anchor_hover_color', 'Link Hover Color', 'sm_field_color_picker', $page, $section, array( 'anchor_hover_color', 'anchor_hover_color_picker' ) ); add_settings_field( 'anchor_visited_color', 'Link Visited Color', 'sm_field_color_picker', $page, $section, array( 'anchor_visited_color', 'anchor_visited_color_picker' ) ); add_settings_section( $section.'_close', '', 'sm_section_close', $page ); // ****** Section Headings $section = $page.'_headings'; add_settings_section( $section, ' Headings (h1,h2,h3....) ', 'sm_section_open', $page); add_settings_field( 'headings_font_color', 'Font Color', 'sm_field_color_picker', $page, $section, array( 'headings_font_color','headings_font_color_picker' ) ); add_settings_field( 'headings_h1_size', 'H1 Font Size (px)', 'sm_field_text_small', $page, $section, array( 'headings_h1_size' ) ); add_settings_field( 'headings_h2_size', 'H2 Font Size (px)', 'sm_field_text_small', $page, $section, array( 'headings_h2_size' ) ); add_settings_field( 'headings_h3_size', 'H3 Font Size (px)', 'sm_field_text_small', $page, $section, array( 'headings_h3_size' ) ); add_settings_field( 'headings_h4_size', 'H4 Font Size (px)', 'sm_field_text_small', $page, $section, array( 'headings_h4_size' ) ); add_settings_field( 'headings_h5_size', 'H5 Font Size (px)', 'sm_field_text_small', $page, $section, array( 'headings_h5_size' ) ); add_settings_field( 'headings_h6_size', 'H6 Font Size (px)', 'sm_field_text_small', $page, $section, array( 'headings_h6_size' ) ); add_settings_section( $section.'_close', '', 'sm_section_close', $page ); } //Register and Build Fields // ************************************* // Section & Fields Callback functions // Section Open Settings function sm_section_open( $section ) { echo '
Fixed Slider Image Size: 960px by 280px
'; } // Dynamic Dropdown Category function sm_field_dropdown_category( $args ) { // Storing All Categories in an array $cats = get_categories(); foreach ( $cats as $cat ) : $categories[$cat->cat_ID] = array( 'value' => $cat->cat_ID, 'label' => $cat->cat_name ); endforeach; $options = get_option( 'plugin_options' ); echo ""; if ( isset( $args[1] ) ) { echo ''.$args[1].'
'; } } // Dynamic Text Size Small Field function sm_field_text_small( $args ) { $options = get_option( 'plugin_options' ); echo ""; if ( isset( $args[1] ) ) { echo ''.$args[1].'
'; } } // Dynamic Text Size Medium Field function sm_field_text_medium( $args ) { $options = get_option( 'plugin_options' ); echo ""; if ( isset( $args[1] ) ) { echo ''.$args[1].'
'; } } // Dynamic Text Size Large Field function sm_field_text_large( $args ) { $options = get_option( 'plugin_options' ); echo ""; if ( isset( $args[1] ) ) { echo ''.$args[1].'
'; } } // Dynamic Textarea Field function sm_field_textarea( $args ) { $options = get_option( 'plugin_options' ); echo "'; if ( isset( $args[1] ) ) { echo ''.$args[1].'
'; } } // Dynamic Checkbox Field function sm_field_checkbox( $args ) { $options = get_option( 'plugin_options' ); $checked = ( $options[$args[0]] ) ? 'checked="checked"' : ''; echo ""; if ( isset( $args[1] ) ) { echo ''.$args[1].'
'; } } // Dynamic Dropdown Field function sm_field_dropdown( $args ) { $options = get_option( 'plugin_options' ); echo ""; if ( isset( $args[2] ) ) { echo ''.$args[2].'
'; } } // Dynamic Color Picker Field function sm_field_color_picker( $args ) { $options = get_option( 'plugin_options' ); echo " "; if ( isset( $args[2] ) ) { echo ''.$args[2].'
'; } } // Dynamic Upload Field function sm_field_upload( $args ) { $options = get_option( 'plugin_options' ); echo ""; // echo ""; if ( isset( $options[$args[0]] ) ) { $file = $options[$args[0]]; echo 'Current File: ' . $file['url'] . '
'; } else { echo ' No Image Uploaded. '; }; if ( isset( $args[1] ) ) { echo '' .$args[1] . '
'; } } ?>