Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- @package animatedtheme
- ========================
- ADMIN PAGE
- ========================
- */
- function animated_add_admin_page() {
- //Generate animated Admin Page
- add_menu_page( 'animated Theme Options', 'Animated', 'manage_options', 'hoogleyboogley_animated', 'animated_theme_create_page', get_template_directory_uri() . '/img/hb-icon.png', 110 );
- //Generate animated Admin Sub Pages
- add_submenu_page( 'hoogleyboogley_animated', 'Animated Theme Options', 'General', 'manage_options', 'hoogleyboogley_animated', 'animated_theme_create_page' );
- add_submenu_page( 'hoogleyboogley_animated', 'Animated CSS Options', 'Custom CSS', 'manage_options', 'hoogleyboogley_animated_css', 'animated_theme_settings_page');
- }
- add_action( 'admin_menu', 'animated_add_admin_page' );
- //Activate custom settings
- add_action( 'admin_init', 'animated_custom_settings' );
- function animated_custom_settings() {
- register_setting( 'animated-settings-group', 'first_name' );
- register_setting( 'animated-settings-group', 'last_name' );
- register_setting( 'animated-settings-group', 'user_description' );
- register_setting( 'animated-settings-group', 'twitter_handler', 'animated_sanitize_twitter_handler' );
- register_setting( 'animated-settings-group', 'facebook_handler' );
- register_setting( 'animated-settings-group', 'gplus_handler' );
- add_settings_section( 'animated-sidebar-options', 'Sidebar Option', 'animated_sidebar_options', 'hoogleyboogley_animated');
- add_settings_field( 'sidebar-name', 'Full Name', 'animated_sidebar_name', 'hoogleyboogley_animated', 'animated-sidebar-options');
- add_settings_field( 'sidebar-description', 'Description', 'animated_sidebar_description', 'hoogleyboogley_animated', 'animated-sidebar-options');
- add_settings_field( 'sidebar-twitter', 'Twitter handler', 'animated_sidebar_twitter', 'hoogleyboogley_animated', 'animated-sidebar-options');
- add_settings_field( 'sidebar-facebook', 'Facebook handler', 'animated_sidebar_facebook', 'hoogleyboogley_animated', 'animated-sidebar-options');
- add_settings_field( 'sidebar-gplus', 'Google+ handler', 'animated_sidebar_gplus', 'hoogleyboogley_animated', 'animated-sidebar-options');
- }
- function animated_sidebar_options() {
- echo 'Customize your Sidebar Information';
- }
- function animated_sidebar_name() {
- $firstName = esc_attr( get_option( 'first_name' ) );
- $lastName = esc_attr( get_option( 'last_name' ) );
- echo '<input type="text" name="first_name" value="'.$firstName.'" placeholder="First Name" /> <input type="text" name="last_name" value="'.$lastName.'" placeholder="Last Name" />';
- }
- function animated_sidebar_description() {
- $description = esc_attr( get_option( 'user_description' ) );
- echo '<input type="text" name="user_description" value="'.$description.'" placeholder="Description" /><p class="description">Write something about your business.</p>';
- }
- function animated_sidebar_twitter() {
- $twitter = esc_attr( get_option( 'twitter_handler' ) );
- echo '<input type="text" name="twitter_handler" value="'.$twitter.'" placeholder="Twitter" /><p class="description">Input your Twitter username without the @.</p>';
- }
- function animated_sidebar_facebook() {
- $facebook = esc_attr( get_option( 'facebook_handler' ) );
- echo '<input type="text" name="facebook_handler" value="'.$facebook.'" placeholder="Facebook" />';
- }
- function animated_sidebar_gplus() {
- $gplus = esc_attr( get_option( 'gplus_handler' ) );
- echo '<input type="text" name="gplus_handler" value="'.$gplus.'" placeholder="Google+" />';
- }
- //Sanitization settings
- function animated_sanitize_twitter_handler( $input ){
- $output = sanitize_text_field( $input );
- $output = str_replace('@', '', $output);
- return $output;
- }
- function animated_theme_create_page() {
- require_once( get_template_directory() . '/inc/templates/animated-admin.php' );
- }
- function animated_theme_settings_page() {
- echo '<h1>Animated Custom CSS</h1>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement