Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'admin_init', 'theme_options_init' );
- add_action( 'admin_menu', 'theme_options_add_page' );
- /**
- * Init plugin options to white list our options
- */
- function theme_options_init(){
- register_setting( 'critter_options', 'critter_theme_options', 'theme_options_validate' );
- }
- /**
- * Load up the menu page
- */
- function theme_options_add_page() {
- add_theme_page( __( 'Theme Options', 'crittertheme' ), __( 'Theme Options', 'crittertheme' ), 'edit_theme_options', 'theme_options', 'theme_options_do_page' );
- }
- /**
- * Create arrays for our select and radio options
- */
- $select_options = array(
- 'lightblue.css' => array(
- 'value' => 'lightblue.css',
- 'label' => __( 'Light Blue', 'crittertheme' )
- ),
- 'darkblue.css' => array(
- 'value' => 'darkblue.css',
- 'label' => __( 'Dark Blue', 'crittertheme' )
- ),
- 'purple.css' => array(
- 'value' => 'purple.css',
- 'label' => __( 'Purple', 'crittertheme' )
- ),
- 'red.css' => array(
- 'value' => 'red.css',
- 'label' => __( 'Red', 'crittertheme' )
- ),
- 'orange.css' => array(
- 'value' => 'orange.css',
- 'label' => __( 'Orange', 'crittertheme' )
- ),
- 'yellow.css' => array(
- 'value' => 'yellow.css',
- 'label' => __( 'Yellow', 'crittertheme' )
- ),
- 'green.css' => array(
- 'value' => 'green.css',
- 'label' => __( 'Green', 'crittertheme' )
- )
- );
- $radio_options = array(
- 'yes' => array(
- 'value' => 'yes',
- 'label' => __( 'Yes', 'crittertheme' )
- ),
- 'no' => array(
- 'value' => 'no',
- 'label' => __( 'No', 'crittertheme' )
- ),
- 'maybe' => array(
- 'value' => 'maybe',
- 'label' => __( 'Maybe', 'crittertheme' )
- )
- );
- $arg = array(
- 'echo' => 1,
- 'selected' => $the_link,
- 'name' => 'theme_option[the_link]');
- $max_id = esc_attr($_POST["element-max-id"]);
- for ($i = 0; $i < $max_id; $i ++) {
- $field_name = "element-page-id-" . $i;
- if (isset($_POST[$field_name])) {
- $front_page_elements[] = esc_attr($_POST[$field_name]);
- }
- }
- /**
- * Create the options page
- */
- function theme_options_do_page() {
- global $select_options, $radio_options;
- if ( ! isset( $_REQUEST['settings-updated'] ) )
- $_REQUEST['settings-updated'] = false;
- ?>
- <div class="wrap">
- <?php screen_icon(); echo "<h2>" . get_current_theme() . __( ' Theme Options', 'crittertheme' ) . "</h2>"; ?>
- <?php if ( false !== $_REQUEST['settings-updated'] ) : ?>
- <div class="updated fade"><p><strong><?php _e( 'Options saved', 'crittertheme' ); ?></strong></p></div>
- <?php endif; ?>
- <form method="post" action="options.php">
- <?php settings_fields( 'critter_options' ); ?>
- <?php $options = get_option( 'critter_theme_options' ); ?>
- <table class="form-table">
- <tr><td><h3>Layout Options</h3></td></tr>
- <tr valign="top"><th scope="row"><?php _e( 'Main Colour Scheme', 'crittertheme' ); ?></th>
- <td>
- <select name="critter_theme_options[colour]">
- <?php
- $selected = $options['colour'];
- $p = '';
- $r = '';
- foreach ( $select_options as $option ) {
- $label = $option['label'];
- if ( $selected == $option['value'] ) // Make default first in list
- $p = "\n\t<option style=\"padding-right: 10px;\" selected='selected' value='" . esc_attr( $option['value'] ) . "'>$label</option>";
- else
- $r .= "\n\t<option style=\"padding-right: 10px;\" value='" . esc_attr( $option['value'] ) . "'>$label</option>";
- }
- echo $p . $r;
- ?>
- </select>
- <label class="description" for="critter_theme_options[colour]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Show Slider on Homepage', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[slider]" name="critter_theme_options[slider]" type="checkbox" value="1" <?php checked( '1', $options['slider'] ); ?> />
- <label class="description" for="critter_theme_options[slider]"><?php _e( 'Yes please', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Show Recent Posts on Homepage', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[showposts1]" name="critter_theme_options[showposts1]" type="checkbox" value="1" <?php checked( '1', $options['showposts1'] ); ?> />
- <label class="description" for="critter_theme_options[showposts1]"><?php _e( 'Yes please', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr><td><h3>Homepage Calls to Action</h3></td></tr>
- <tr valign="top"><th scope="row"><?php _e( 'Show Calls to Action on Homepage', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[showctas]" name="critter_theme_options[showctas]" type="checkbox" value="1" <?php checked( '1', $options['showctas'] ); ?> />
- <label class="description" for="critter_theme_options[showctas]"><?php _e( 'Yes please', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr>
- <td>
- <h4>Doctors/Staff Call to Action</h4>
- <label class="description" for="critter_theme_options[doctors_title]"><?php _e( 'Call to Action Title', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[doctors_title]" class="regular-text" type="text" name="critter_theme_options[doctors_title]" value="<?php esc_attr_e( $options['doctors_title'] ); ?>" /><br />
- <label class="description" for="critter_theme_options[doctors_text]"><?php _e( 'Call to Action Text', 'crittertheme' ); ?></label>
- <textarea rows="4" cols="30" id="critter_theme_options[doctors_text]" class="regular-text" type="text" name="critter_theme_options[doctors_text]" value="Doctors/staff call to action content goes here"><?php esc_attr_e( $options['doctors_text'] ); ?></textarea><br />
- <label class="description" for="critter_theme_options[doctors_link_text]"><?php _e( 'Call to Action Link', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[doctors_link_text]" class="regular-text" type="text" name="critter_theme_options[doctors_button_text]" value="<?php esc_attr_e( $options['doctors_button_text'] ); ?>" />
- <label class="description" for="critter_theme_options[doctors_button_text]"><?php _e( 'Call to Action Button Text', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[doctors_link_text]" class="regular-text" type="text" name="critter_theme_options[doctors_link_text]" value="<?php esc_attr_e( $options['doctors_link_text'] ); ?>" />
- <?php wp_dropdown_pages($arg); ?>
- </td>
- <td>
- <h4>Services Call to Action</h4>
- <label class="description" for="critter_theme_options[services_title]"><?php _e( 'Call to Action Title', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[services_title]" class="regular-text" type="text" name="critter_theme_options[services_title]" value="<?php esc_attr_e( $options['services_title'] ); ?>" /><br />
- <label class="description" for="critter_theme_options[services_text]"><?php _e( 'Call to Action Text', 'crittertheme' ); ?></label>
- <textarea rows="4" cols="30" id="critter_theme_options[services_text]" class="regular-text" type="text" name="critter_theme_options[services_text]" value="Services call to action content goes here"><?php esc_attr_e( $options['services_text'] ); ?></textarea><br />
- <label class="description" for="critter_theme_options[services_link_text]"><?php _e( 'Call to Action Link', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[services_button_text]" class="regular-text" type="text" name="critter_theme_options[services_button_text]" value="<?php esc_attr_e( $options['services_button_text'] ); ?>" />
- <label class="description" for="critter_theme_options[services_button_text]"><?php _e( 'Call to Action Button Text', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[services_link_text]" class="regular-text" type="text" name="critter_theme_options[services_link_text]" value="<?php esc_attr_e( $options['services_link_text'] ); ?>" />
- <select name="critter_service_link">
- <option value="">Nowhere</option>
- <?php foreach(get_pages() as $page){ ?>
- <option value="<?php echo $page->ID;?>"<?php esc_attr_e($options['services_link'] == $page->ID) ? ' selected':'';?>><?php echo $page->post_title;?></option>
- <?php } ?>
- </select>
- </td>
- <td>
- <h4>Testimonials Call to Action</h4>
- <label class="description" for="critter_theme_options[testimonial_title]"><?php _e( 'Call to Action Title', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[testimonial_title]" class="regular-text" type="text" name="critter_theme_options[testimonial_title]" value="<?php esc_attr_e( $options['testimonial_title'] ); ?>" /><br />
- <label class="description" for="critter_theme_options[testimonial_text]"><?php _e( 'Call to Action Text', 'crittertheme' ); ?></label>
- <textarea rows="4" cols="30" id="critter_theme_options[testimonial_text]" class="regular-text" type="text" name="critter_theme_options[testimonial_text]" value="Services call to action content goes here"><?php esc_attr_e( $options['testimonial_text'] ); ?></textarea><br />
- <label class="description" for="critter_theme_options[testimonial_link_text]"><?php _e( 'Call to Action Link', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[testimonial_button_text]" class="regular-text" type="text" name="critter_theme_options[testimonial_button_text]" value="<?php esc_attr_e( $options['testimonial_button_text'] ); ?>" />
- <label class="description" for="critter_theme_options[testimonial_button_text]"><?php _e( 'Call to Action Button Text', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[testimonial_link_text]" class="regular-text" type="text" name="critter_theme_options[testimonial_link_text]" value="<?php esc_attr_e( $options['testimonial_link_text'] ); ?>" />
- <select name="critter_service_link">
- <option value="">Nowhere</option>
- <?php foreach(get_pages() as $page){ ?>
- <option value="<?php echo $page->ID;?>"<?php esc_attr_e($options['testimonial_link'] == $page->ID) ? ' selected':'';?>><?php echo $page->post_title;?></option>
- <?php } ?>
- </select>
- </td>
- </tr>
- <?php
- /**
- * The Contact Information
- */
- ?>
- <tr><td><h3>Footer Calls to Action</h3></td></tr>
- <td>
- <h4>Footer Doctors/Staff Call to Action</h4>
- <label class="description" for="critter_theme_options[footer_doctors_title]"><?php _e( 'Call to Action Title', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[footer_doctors_title]" class="regular-text" type="text" name="critter_theme_options[footer_doctors_title]" value="<?php esc_attr_e( $options['footer_doctors_title'] ); ?>" /><br />
- <label class="description" for="critter_theme_options[footer_doctors_text]"><?php _e( 'Call to Action Text', 'crittertheme' ); ?></label>
- <textarea rows="4" cols="30" id="critter_theme_options[footer_doctors_text]" class="regular-text" type="text" name="critter_theme_options[footer_doctors_text]" value="Doctors/staff call to action content goes here"><?php esc_attr_e( $options['footer_doctors_text'] ); ?></textarea><br />
- <label class="description" for="critter_theme_options[footer_doctors_link_text]"><?php _e( 'Call to Action Link', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[footer_doctors_link_text]" class="regular-text" type="text" name="critter_theme_options[footer_doctors_link_text]" value="<?php esc_attr_e( $options['doctors_link_text'] ); ?>" />
- <label class="description" for="critter_theme_options[footer_doctors_button_text]"><?php _e( 'Call to Action Button Text', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[footer_doctors_button_text]" class="regular-text" type="text" name="critter_theme_options[footer_doctors_button_text]" value="<?php esc_attr_e( $options['footer_doctors_button_text'] ); ?>" />
- <select name="critter_service_link">
- <option value="">Nowhere</option>
- <?php foreach(get_pages() as $page){ ?>
- <option value="<?php echo $page->ID;?>"<?php esc_attr_e($options['footer_doctors_link'] == $page->ID) ? ' selected':'';?>><?php echo $page->post_title;?></option>
- <?php } ?>
- </select>
- </td>
- <td>
- <h4>Footer Services Call to Action</h4>
- <label class="description" for="critter_theme_options[footer_services_title]"><?php _e( 'Call to Action Title', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[footer_services_title]" class="regular-text" type="text" name="critter_theme_options[footer_services_title]" value="<?php esc_attr_e( $options['footer_services_title'] ); ?>" /><br />
- <label class="description" for="critter_theme_options[footer_services_text]"><?php _e( 'Call to Action Text', 'crittertheme' ); ?></label>
- <textarea rows="4" cols="30" id="critter_theme_options[footer_services_text]" class="regular-text" type="text" name="critter_theme_options[footer_services_text]" value="Services call to action content goes here"><?php esc_attr_e( $options['footer_services_text'] ); ?></textarea><br />
- <label class="description" for="critter_theme_options[footer_services_link_text]"><?php _e( 'Call to Action Link', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[footer_services_link_text]" class="regular-text" type="text" name="critter_theme_options[footer_services_link_text]" value="<?php esc_attr_e( $options['services_link_text'] ); ?>" />
- <label class="description" for="critter_theme_options[footer_services_button_text]"><?php _e( 'Call to Action Button Text', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[footer_services_button_text]" class="regular-text" type="text" name="critter_theme_options[footer_services_button_text]" value="<?php esc_attr_e( $options['footer_services_button_text'] ); ?>" />
- <select name="critter_service_link">
- <option value="">Nowhere</option>
- <?php foreach(get_pages() as $page){ ?>
- <option value="<?php echo $page->ID;?>"<?php esc_attr_e($options['footer_services_link'] == $page->ID) ? ' selected':'';?>><?php echo $page->post_title;?></option>
- <?php } ?>
- </select>
- </td>
- <td>
- <h4>Footer Testimonials Call to Action</h4>
- <label class="description" for="critter_theme_options[footer_testimonial_title]"><?php _e( 'Call to Action Title', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[footer_testimonial_title]" class="regular-text" type="text" name="critter_theme_options[footer_testimonial_title]" value="<?php esc_attr_e( $options['footer_testimonial_title'] ); ?>" /><br />
- <label class="description" for="critter_theme_options[footer_testimonial_text]"><?php _e( 'Call to Action Text', 'crittertheme' ); ?></label>
- <textarea rows="4" cols="30" id="critter_theme_options[footer_testimonial_text]" class="regular-text" type="text" name="critter_theme_options[footer_testimonial_text]" value="Services call to action content goes here"><?php esc_attr_e( $options['footer_testimonial_text'] ); ?></textarea><br />
- <label class="description" for="critter_theme_options[footer_testimonial_link_text]"><?php _e( 'Call to Action Link', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[footer_testimonial_link_text]" class="regular-text" type="text" name="critter_theme_options[footer_testimonial_link_text]" value="<?php esc_attr_e( $options['footer_testimonial_link_text'] ); ?>" />
- <label class="description" for="critter_theme_options[footer_testimonial_button_text]"><?php _e( 'Call to Action Button Text', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[footer_testimonial_button_text]" class="regular-text" type="text" name="critter_theme_options[footer_testimonial_button_text]" value="<?php esc_attr_e( $options['footer_testimonial_button_text'] ); ?>" />
- <select name="critter_service_link">
- <option value="">Nowhere</option>
- <?php foreach(get_pages() as $page){ ?>
- <option value="<?php echo $page->ID;?>"<?php esc_attr_e($options['footer_testimonial_link'] == $page->ID) ? ' selected':'';?>><?php echo $page->post_title;?></option>
- <?php } ?>
- </select>
- </td>
- <tr><td><h3>Contact Information</h3></td></tr>
- <tr valign="top"><th scope="row"><?php _e( 'Phone Number', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[phonenumber]" class="regular-text" type="text" name="critter_theme_options[phonenumber]" value="<?php esc_attr_e( $options['phonenumber'] ); ?>" />
- <label class="description" for="critter_theme_options[phonenumber]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Fax Number', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[faxnumber]" class="regular-text" type="text" name="critter_theme_options[faxnumber]" value="<?php esc_attr_e( $options['faxnumber'] ); ?>" />
- <label class="description" for="critter_theme_options[faxnumber]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Emergency Number', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[emergencynumber]" class="regular-text" type="text" name="critter_theme_options[emergencynumber]" value="<?php esc_attr_e( $options['emergencynumber'] ); ?>" />
- <label class="description" for="critter_theme_options[emergencynumber]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Google Maps Friendly Address', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[googlemaps]" class="regular-text" type="text" name="critter_theme_options[googlemaps]" value="<?php esc_attr_e( $options['googlemaps'] ); ?>" />
- <label class="description" for="critter_theme_options[googlemaps]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <?php
- /**
- * Social Media Profiles
- */
- ?>
- <tr><td><h3>Social Media Profile Links</h3></td></tr>
- <tr valign="top"><th scope="row"><?php _e( 'Facebook Page', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[facebook]" class="regular-text" type="text" name="critter_theme_options[facebook]" value="<?php esc_attr_e( $options['facebook'] ); ?>" />
- <label class="description" for="critter_theme_options[facebook]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Twitter Account', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[twitter]" class="regular-text" type="text" name="critter_theme_options[twitter]" value="<?php esc_attr_e( $options['twitter'] ); ?>" />
- <label class="description" for="critter_theme_options[twitter]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'LinkedIn Profile', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[linkedin]" class="regular-text" type="text" name="critter_theme_options[linkedin]" value="<?php esc_attr_e( $options['linkedin'] ); ?>" />
- <label class="description" for="critter_theme_options[linkedin]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'YouTube Account', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[youtube]" class="regular-text" type="text" name="critter_theme_options[youtube]" value="<?php esc_attr_e( $options['youtube'] ); ?>" />
- <label class="description" for="critter_theme_options[youtube]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Google+ Profile', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[googleplus]" class="regular-text" type="text" name="critter_theme_options[googleplus]" value="<?php esc_attr_e( $options['googleplus'] ); ?>" />
- <label class="description" for="critter_theme_options[googleplus]"><?php _e( '', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <?php
- /**
- * Hours of Operation
- */
- ?>
- <tr>
- <td><h3>Hours of Operation</h3></td>
- <td><p>If closed, just fill in 'Closed' in the first field for that day.</p></td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Display Hours of Operation', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[hours]" name="critter_theme_options[hours]" type="checkbox" value="1" <?php checked( '1', $options['hours'] ); ?> />
- <label class="description" for="critter_theme_options[hours]"><?php _e( 'Yes please', 'crittertheme' ); ?></label>
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Monday', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[monday1]" class="regular-text" type="text" name="critter_theme_options[monday1]" value="<?php esc_attr_e( $options['monday1'] ); ?>" />
- <label class="description" for="critter_theme_options[monday1]"><?php _e( ' - ', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[monday2]" class="regular-text" type="text" name="critter_theme_options[monday2]" value="<?php esc_attr_e( $options['monday2'] ); ?>" />
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Tuesday', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[tuesday1]" class="regular-text" type="text" name="critter_theme_options[tuesday1]" value="<?php esc_attr_e( $options['tuesday1'] ); ?>" />
- <label class="description" for="critter_theme_options[tuesday1]"><?php _e( ' - ', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[tuesday2]" class="regular-text" type="text" name="critter_theme_options[tuesday2]" value="<?php esc_attr_e( $options['tuesday2'] ); ?>" />
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Wednesday', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[wednesday1]" class="regular-text" type="text" name="critter_theme_options[wednesday1]" value="<?php esc_attr_e( $options['wednesday1'] ); ?>" />
- <label class="description" for="critter_theme_options[wednesday1]"><?php _e( ' - ', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[wednesday2]" class="regular-text" type="text" name="critter_theme_options[wednesday2]" value="<?php esc_attr_e( $options['wednesday2'] ); ?>" />
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Thursday', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[thursday1]" class="regular-text" type="text" name="critter_theme_options[thursday1]" value="<?php esc_attr_e( $options['thursday1'] ); ?>" />
- <label class="description" for="critter_theme_options[thursday1]"><?php _e( ' - ', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[thursday2]" class="regular-text" type="text" name="critter_theme_options[thursday2]" value="<?php esc_attr_e( $options['thursday2'] ); ?>" />
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Friday', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[friday1]" class="regular-text" type="text" name="critter_theme_options[friday1]" value="<?php esc_attr_e( $options['friday1'] ); ?>" />
- <label class="description" for="critter_theme_options[friday1]"><?php _e( ' - ', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[friday2]" class="regular-text" type="text" name="critter_theme_options[friday2]" value="<?php esc_attr_e( $options['friday2'] ); ?>" />
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Saturday', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[saturday1]" class="regular-text" type="text" name="critter_theme_options[saturday1]" value="<?php esc_attr_e( $options['saturday1'] ); ?>" />
- <label class="description" for="critter_theme_options[saturday1]"><?php _e( ' - ', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[saturday2]" class="regular-text" type="text" name="critter_theme_options[saturday2]" value="<?php esc_attr_e( $options['saturday2'] ); ?>" />
- </td>
- </tr>
- <tr valign="top"><th scope="row"><?php _e( 'Sunday', 'crittertheme' ); ?></th>
- <td>
- <input id="critter_theme_options[sunday1]" class="regular-text" type="text" name="critter_theme_options[sunday1]" value="<?php esc_attr_e( $options['sunday1'] ); ?>" />
- <label class="description" for="critter_theme_options[sunday1]"><?php _e( ' - ', 'crittertheme' ); ?></label>
- <input id="critter_theme_options[sunday2]" class="regular-text" type="text" name="critter_theme_options[sunday2]" value="<?php esc_attr_e( $options['sunday2'] ); ?>" />
- </td>
- </tr>
- </table>
- <p class="submit">
- <input type="submit" class="button-primary" value="<?php _e( 'Save Options', 'crittertheme' ); ?>" />
- </p>
- </form>
- </div>
- <?php
- }
- /**
- * Sanitize and validate input. Accepts an array, return a sanitized array.
- */
- function theme_options_validate( $input ) {
- global $select_options, $radio_options;
- // Our checkbox value is either 0 or 1
- if ( ! isset( $input['slider'] ) )
- $input['slider'] = null;
- $input['slider'] = ( $input['slider'] == 1 ? 1 : 0 );
- if ( ! isset( $input['showposts1'] ) )
- $input['showposts1'] = null;
- $input['showposts1'] = ( $input['showposts1'] == 1 ? 1 : 0 );
- if ( ! isset( $input['showctas'] ) )
- $input['showctas'] = null;
- $input['showctas'] = ( $input['showctas'] == 1 ? 1 : 0 );
- if ( ! isset( $input['hours'] ) )
- $input['hours'] = null;
- $input['hours'] = ( $input['hours'] == 1 ? 1 : 0 );
- // Say our text option must be safe text with no HTML tags
- $input['doctors_title'] = wp_filter_nohtml_kses( $input['doctors_title'] );
- $input['doctors_text'] = wp_filter_nohtml_kses( $input['doctors_text'] );
- $input['doctors_link_text'] = wp_filter_nohtml_kses( $input['doctors_link_text'] );
- $input['doctors_button_text'] = wp_filter_nohtml_kses( $input['doctors_button_text'] );
- $input['doctors_link'] = wp_filter_nohtml_kses( $input['doctors_link'] );
- $input['services_title'] = wp_filter_nohtml_kses( $input['services_title'] );
- $input['services_text'] = wp_filter_nohtml_kses( $input['services_text'] );
- $input['services_button_text'] = wp_filter_nohtml_kses( $input['services_button_text'] );
- $input['services_link_text'] = wp_filter_nohtml_kses( $input['services_link_text'] );
- $input['services_link'] = wp_filter_nohtml_kses( $input['services_link'] );
- $input['testimonial_title'] = wp_filter_nohtml_kses( $input['testimonial_title'] );
- $input['testimonial_text'] = wp_filter_nohtml_kses( $input['testimonial_text'] );
- $input['testimonial_button_text'] = wp_filter_nohtml_kses( $input['testimonial_button_text'] );
- $input['testimonial_link_text'] = wp_filter_nohtml_kses( $input['testimonial_link_text'] );
- $input['testimonial_link'] = wp_filter_nohtml_kses( $input['testimonial_link'] );
- $input['footer_doctors_title'] = wp_filter_nohtml_kses( $input['footer_doctors_title'] );
- $input['footer_doctors_text'] = wp_filter_nohtml_kses( $input['footer_doctors_text'] );
- $input['footer_doctors_link_text'] = wp_filter_nohtml_kses( $input['footer_doctors_link_text'] );
- $input['footer_doctors_button_text'] = wp_filter_nohtml_kses( $input['footer_doctors_button_text'] );
- $input['footer_doctors_link'] = wp_filter_nohtml_kses( $input['footer_doctors_link'] );
- $input['footer_services_title'] = wp_filter_nohtml_kses( $input['footer_services_title'] );
- $input['footer_services_text'] = wp_filter_nohtml_kses( $input['footer_services_text'] );
- $input['footer_services_link_text'] = wp_filter_nohtml_kses( $input['footer_services_link_text'] );
- $input['footer_services_button_text'] = wp_filter_nohtml_kses( $input['footer_services_button_text'] );
- $input['footer_services_link'] = wp_filter_nohtml_kses( $input['footer_services_link'] );
- $input['footer_testimonial_title'] = wp_filter_nohtml_kses( $input['footer_testimonial_title'] );
- $input['footer_testimonial_text'] = wp_filter_nohtml_kses( $input['footer_testimonial_text'] );
- $input['footer_testimonial_link_text'] = wp_filter_nohtml_kses( $input['footer_testimonial_link_text'] );
- $input['footer_testimonial_button_text'] = wp_filter_nohtml_kses( $input['footer_testimonial_button_text'] );
- $input['footer_testimonial_link'] = wp_filter_nohtml_kses( $input['footer_testimonial_link'] );
- $input['phonenumber'] = wp_filter_nohtml_kses( $input['phonenumber'] );
- $input['emergencynumber'] = wp_filter_nohtml_kses( $input['emergencynumber'] );
- $input['faxnumber'] = wp_filter_nohtml_kses( $input['faxnumber'] );
- $input['googlemaps'] = wp_filter_nohtml_kses( $input['googlemaps'] );
- $input['facebook'] = wp_filter_nohtml_kses( $input['facebook'] );
- $input['twitter'] = wp_filter_nohtml_kses( $input['twitter'] );
- $input['linkedin'] = wp_filter_nohtml_kses( $input['linkedin'] );
- $input['youtube'] = wp_filter_nohtml_kses( $input['youtube'] );
- $input['googlemaps'] = wp_filter_nohtml_kses( $input['googlemaps'] );
- $input['monday1'] = wp_filter_nohtml_kses( $input['monday1'] );
- $input['monday2'] = wp_filter_nohtml_kses( $input['monday2'] );
- $input['tuesday1'] = wp_filter_nohtml_kses( $input['tuesday1'] );
- $input['tuesday2'] = wp_filter_nohtml_kses( $input['tuesday2'] );
- $input['wednesday1'] = wp_filter_nohtml_kses( $input['wednesday1'] );
- $input['wednesday2'] = wp_filter_nohtml_kses( $input['wednesday2'] );
- $input['thursday1'] = wp_filter_nohtml_kses( $input['thursday1'] );
- $input['thursday2'] = wp_filter_nohtml_kses( $input['thursday2'] );
- $input['friday1'] = wp_filter_nohtml_kses( $input['friday1'] );
- $input['friday2'] = wp_filter_nohtml_kses( $input['friday2'] );
- $input['saturday1'] = wp_filter_nohtml_kses( $input['saturday1'] );
- $input['saturday2'] = wp_filter_nohtml_kses( $input['saturday2'] );
- $input['sunday1'] = wp_filter_nohtml_kses( $input['sunday1'] );
- $input['sunday2'] = wp_filter_nohtml_kses( $input['sunday2'] );
- // Our select option must actually be in our array of select options
- if ( ! array_key_exists( $input['selectinput'], $select_options ) )
- $input['selectinput'] = null;
- $input['the_link'] = get_option('the_link');
- // Our radio option must actually be in our array of radio options
- if ( ! isset( $input['radioinput'] ) )
- $input['radioinput'] = null;
- if ( ! array_key_exists( $input['radioinput'], $radio_options ) )
- $input['radioinput'] = null;
- // Say our textarea option must be safe text with the allowed tags for posts
- $input['sometextarea'] = wp_filter_post_kses( $input['sometextarea'] );
- return $input;
- }
- // adapted from http://planetozh.com/blog/2009/05/handling-plugins-options-in-wordpress-28-with-register_setting/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement