__( 'Top Navigation', 'android' ), 'navbar' => __( 'Navigation Bar', 'android' ), ) ); // This theme allows users to set a custom background add_custom_background('', 'android_admin_background_style'); // Your changeable header business starts here define( 'HEADER_TEXTCOLOR', '' ); // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI. define( 'HEADER_IMAGE', '%s/images/header.png' ); // The height and width of your custom header. You can hook into the theme's own filters to change these values. // Add a filter to android_header_image_width and android_header_image_height to change these values. define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'android_header_image_height', 140 ) ); define( 'HEADER_IMAGE_WIDTH' , apply_filters( 'android_header_image_width' , 670 ) ); // User can disable the post thumbnails function from the settingd psge. add_option('android_use_thumbnails', false ); // It's still beta! // Now, the user can change the default post thumbnail height so, let's add our default. // Anyway the height should be between 100 and 300. add_option('android_thumbnail_height', 300); // Don't support text inside the header image. define( 'NO_HEADER_TEXT', true ); // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. register_default_headers( array( 'android' => array( 'url' => '%s/images/headers/header.png', 'thumbnail_url' => '%s/images/headers/header-thumbnail.png', /* translators: header image description */ 'description' => __( 'Android', 'android' ) ), 'android2' => array( 'url' => '%s/images/headers/header2.png', 'thumbnail_url' => '%s/images/headers/header2-thumbnail.png', /* translators: header image description */ 'description' => __( 'Android', 'android' ) . ' 2' ), 'android3' => array( 'url' => '%s/images/headers/header3.png', 'thumbnail_url' => '%s/images/headers/header3-thumbnail.png', /* translators: header image description */ 'description' => __( 'Android', 'android' ) . ' 3' ), )); // Add a way for the custom header to be styled in the admin panel that controls // custom headers. See android_admin_header_style(), below. add_custom_image_header( '', 'android_admin_header_style' ); /* //add options add_option('android_fb_page_id', ''); add_option('android_fb_likebox', false); add_option('android_fb_like', true); add_option('android_color_scheme', ''); add_option('android_show_author', true); */ //social links options $default_social = array( 'rss' => array( get_bloginfo('name').' RSS', get_bloginfo('rss2_url') ), 'twitter' => array( 'Louy on Twitter', 'http://twitter.com/l0uy' ), 'facebook' => array( 'Louy on Facebook', 'http://www.facebook.com/louy08' ), 'flickr' => array( 'Louy on Flickr', 'http://www.flickr.com/people/lo-uy/' ), 'youtube' => array( 'Louy on YouTube', 'http://www.youtube.com/MrL0uy' ), ); add_option( 'android_social_icons', $default_social ); if( get_option('android_use_thubmnails') ) { // This theme uses post thumbnails add_theme_support( 'post-thumbnails' ); // We'll be using post thumbnails for custom header images on posts and pages. // We want them to be 940 pixels wide by 198 pixels tall. // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. set_post_thumbnail_size( 660, get_option('android_thumbnail_height'), true ); // Now, add a new thumbnail size to use in one column pages. add_image_size( 'onecolumn-thumbnail', 990, get_option('android_thumbnail_height'), true ); } } function android_admin_header_style() { ?> __( 'Primary Widget Area', 'android' ), 'id' => 'primary-widget-area', 'description' => __( 'The primary widget area', 'android' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } /** Register the sidebar by running android_widgets_init() on the widgets_init hook. */ add_action( 'widgets_init', 'android_widgets_init' ); /** * Remove inline styles printed when the gallery shortcode is used. * * Galleries are styled by the theme in Android's style.css. */ function android_remove_gallery_css( $css ) { return preg_replace( "##s", '', $css ); } add_filter( 'gallery_style', 'android_remove_gallery_css' ); /** * display post meta. */ function android_posted_on() { printf( __( 'Posted on %1$s', 'android' ), sprintf( '%3$s', get_permalink(), esc_attr( get_the_time() ), get_the_date() ) ); } function android_post_meta() { if( !is_page() && !is_attachment() ) { echo '' . sprintf( '%3$s', get_author_posts_url( get_the_author_meta( 'ID' ) ), sprintf( esc_attr__( 'View all posts by %s', 'android' ), get_the_author() ), get_the_author() ) . ''; if( $t = get_the_category_list( ', ' ) ) { echo '' . $t . ''; } if( $t = get_the_tag_list( '', ', ' ) ) { echo '' . $t . ''; } } if( have_comments() or comments_open() ) { echo ''; comments_popup_link('0', '1', '%', 'post-comments-count'); echo ''; } edit_post_link( __( 'Edit', 'android' ), '', '' ); } /** * Android options page */ function android_admin_page() { if ( !current_user_can('edit_theme_options') ) wp_die(__('Cheatin’ uh?', 'android')); include TEMPLATEPATH.'/admin.php'; } /** * add options page to the admin menu */ function android_admin_menu() { add_theme_page( 'Android Options', 'Android Options', 'edit_theme_options', basename(__FILE__), 'android_admin_page' ); } add_action( 'admin_menu', 'android_admin_menu' ); /** * Save Android options */ function save_android_options() { if( isset( $_POST['android_save'] ) && $_POST['android_save'] == 'yes' ) { $thumbnail_height = get_option('android_thumbnail_height'); if( isset( $_POST['android_thumbnail_height'] ) && is_numeric( $_POST['android_thumbnail_height'] ) ) { if( $thumbnail_height != $_POST['android_thumbnail_height'] && is_numeric($thumbnail_height) && $thumbnail_height > 100 && $thumbnail_height < 300 ) { update_option('android_thumbnail_height', $_POST['android_thumbnail_height']); } } /* $fb_page_id = get_option('android_fb_page_id'); if( isset( $_POST['android_fb_page_id'] ) && is_numeric( $_POST['android_fb_page_id'] ) ) { if( $fb_page_id != $_POST['android_fb_page_id'] ) { update_option('android_fb_page_id', $_POST['android_fb_page_id']); } } $fb_likebox = get_option('android_fb_likebox'); if( isset( $_POST['android_fb_likebox'] ) && $_POST['android_fb_likebox'] == 'yes' ) { if( !$fb_likebox ) { update_option('android_fb_likebox', true); } } else { if( $fb_likebox ) { update_option('android_fb_likebox', false); } } $fb_like = get_option('android_fb_like'); if( isset( $_POST['android_fb_like'] ) && $_POST['android_fb_like'] == 'yes' ) { if( !$fb_like ) { update_option('android_fb_like', true); } } else { if( $fb_like ) { update_option('android_fb_like', false); } } */ $show_author = get_option('android_show_author'); if( isset( $_POST['android_show_author'] ) && $_POST['android_show_author'] == 'yes' ) { if( !$show_author ) { update_option('android_show_author', true); } } else { if( $show_author ) { update_option('android_show_author', false); } } $color_scheme = get_option('android_color_scheme'); if( isset( $_POST['android_color_scheme'] ) ) { $schemes = android_color_schemes(); if( $_POST['android_color_scheme'] != $color_scheme ) { if( in_array( $_POST['android_color_scheme'], array_keys( $schemes ) ) ) { update_option('android_color_scheme', $_POST['android_color_scheme']); } } } // Social icons $icons = android_social_icons(); $social_icons = get_option('android_social_icons'); $new_icons = array(); foreach( $icons as $icon => $name ) { if( isset( $_POST['android_'.$icon.'_linktitle'], $_POST['android_'.$icon.'_url'] ) && !empty( $_POST['android_'.$icon.'_linktitle'] ) && (bool)preg_match( '#http(s?)://(.+)#i', $_POST['android_'.$icon.'_url']) ) { $_POST['android_'.$icon.'_url'] = esc_url_raw($_POST['android_'.$icon.'_url']); $new_icons[$icon] = array($_POST['android_'.$icon.'_linktitle'], $_POST['android_'.$icon.'_url']); } } if( $new_icons != $social_icons ) { update_option('android_social_icons', $new_icons); } wp_redirect( admin_url('themes.php?page=functions.php&saved=true') ); } } add_action('load-appearance_page_functions', 'save_android_options'); $content_width = 660; function android_color_schemes() { return apply_filters('android_color_schemes', array( '' => __('Green', 'android'), 'red' => __('Red' , 'android'), 'blue' => __('Blue' , 'android') )); } function android_head() { //display stylesheet lnk of color scheme $scheme = get_option('android_color_scheme'); if( $scheme != '' ) { echo ''; } } add_action( 'wp_head', 'android_head' ); function android_social_icons() { return array( 'rss' => 'RSS', 'twitter' => 'Twitter', 'facebook' => 'Facebook', 'flickr' => 'Flickr', 'youtube' => 'YouTube', 'digg' => 'Digg', 'delicious' => 'del.icio.us', 'deviant_art' => 'DeviantArt', 'bebo' => 'Bebo', 'blogger' => 'Blogger' ); }