Want more features on Pastebin? Sign Up, it's FREE!
Guest

functions.php

By: a guest on Feb 29th, 2012  |  syntax: PHP  |  size: 4.61 KB  |  views: 282  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3.  * @package WordPress
  4.  * @subpackage Coraline
  5.  */
  6.  
  7. /**
  8.  * Set the content width based on the theme's design and stylesheet.
  9.  */
  10. if ( ! isset( $content_width ) )
  11.         $content_width = 500;
  12.  
  13. /** Tell WordPress to run coraline_setup() when the 'after_setup_theme' hook is run. */
  14. add_action( 'after_setup_theme', 'coraline_setup' );
  15.  
  16. if ( ! function_exists( 'coraline_setup' ) ):
  17. /**
  18.  * Sets up theme defaults and registers support for various WordPress features.
  19.  *
  20.  * To override coraline_setup() in a child theme, add your own coraline_setup to your child theme's
  21.  * functions.php file.
  22.  *
  23.  * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
  24.  * @uses register_nav_menus() To add support for navigation menus.
  25.  * @uses add_custom_background() To add support for a custom background.
  26.  * @uses add_editor_style() To style the visual editor.
  27.  * @uses load_theme_textdomain() For translation/localization support.
  28.  * @uses add_custom_image_header() To add support for a custom header.
  29.  * @uses register_default_headers() To register the default custom header images provided with the theme.
  30.  * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
  31.  *
  32.  * @since Coraline 1.0
  33.  */
  34. function coraline_setup() {
  35.  
  36.         // This theme has some pretty cool theme options
  37.         require_once ( get_template_directory() . '/inc/theme-options.php' );
  38.  
  39.         // This theme styles the visual editor with editor-style.css to match the theme style.
  40.         add_editor_style();
  41.  
  42.         // Post Format support. Legacy category chooser will display in Theme Options for sites that set a category before post formats were added.
  43.         add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
  44.  
  45.         // This theme uses post thumbnails
  46.         add_theme_support( 'post-thumbnails' );
  47.  
  48.         // Add default posts and comments RSS feed links to head
  49.         add_theme_support( 'automatic-feed-links' );
  50.  
  51.         // Make theme available for translation
  52.         // Translations can be filed in the /languages/ directory
  53.         load_theme_textdomain( 'coraline', get_template_directory() . '/languages' );
  54.  
  55.         $locale = get_locale();
  56.         $locale_file = get_template_directory() . "/languages/$locale.php";
  57.         if ( is_readable( $locale_file ) )
  58.                 require_once( $locale_file );
  59.  
  60.         // This theme uses wp_nav_menu() in one location.
  61.         register_nav_menus( array(
  62.                 'primary' => __( 'Primary Navigation', 'coraline' ),
  63.         ) );
  64.  
  65.         // This theme allows users to set a custom background
  66.         add_custom_background();
  67.  
  68.         // Your changeable header business starts here
  69.         define( 'HEADER_TEXTCOLOR', '000' );
  70.         // No CSS, just an IMG call. The %s is a placeholder for the theme template directory URI.
  71.         define( 'HEADER_IMAGE', '%s/images/headers/water-drops.jpg' );
  72.  
  73.         // The height and width of your custom header. You can hook into the theme's own filters to change these values.
  74.         // Add a filter to coraline_header_image_width and coraline_header_image_height to change these values.
  75.         define( 'HEADER_IMAGE_WIDTH', apply_filters( 'coraline_header_image_width', 990 ) );
  76.         define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'coraline_header_image_height', 180 ) );
  77.  
  78.         // We'll be using post thumbnails for custom header images on posts and pages.
  79.         // We want them to be 940 pixels wide by 198 pixels tall.
  80.         // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
  81.         set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
  82.  
  83.         // Add a way for the custom header to be styled in the admin panel that controls
  84.         // custom headers. See coraline_admin_header_style(), below.
  85.         add_custom_image_header( 'coraline_header_style', 'coraline_admin_header_style', 'coraline_admin_header_image' );
  86.  
  87.         // ... and thus ends the changeable header business.
  88.  
  89.         // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
  90.         register_default_headers( array(
  91.                 'water-drops' => array(
  92.                         'url' => '%s/images/headers/water-drops.jpg',
  93.                         'thumbnail_url' => '%s/images/headers/water-drops-thumbnail.jpg',
  94.                         /* translators: header image description */
  95.                         'description' => __( 'Water drops', 'coraline' )
  96.                 ),
  97.                 'limestone-cave' => array(
  98.                         'url' => '%s/images/headers/limestone-cave.jpg',
  99.                         'thumbnail_url' => '%s/images/headers/limestone-cave-thumbnail.jpg',
  100.                         /* translators: header image description */
  101.                         'description' => __( 'Limestone cave', 'coraline' )
  102.                 ),
  103.                 'Cactii' => array(
  104.                         'url' => '%s/images/headers/cactii.jpg',
  105.                         'thumbnail_url' => '%s/images/headers/cactii-thumbnail.jpg',
  106.                         /* translators: header image description */
  107.                         'description' => __( 'Cactii', 'coraline' )
  108.                 )
  109.         ) );
  110. }
  111. endif;
  112. ?>
clone this paste RAW Paste Data