<?php
/**
* @package WordPress
* @subpackage Coraline
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) )
$content_width = 500;
/** Tell WordPress to run coraline_setup() when the 'after_setup_theme' hook is run. */
add_action( 'after_setup_theme', 'coraline_setup' );
if ( ! function_exists( 'coraline_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* To override coraline_setup() in a child theme, add your own coraline_setup to your child theme's
* functions.php file.
*
* @uses add_theme_support() To add support for post thumbnails and automatic feed links.
* @uses register_nav_menus() To add support for navigation menus.
* @uses add_custom_background() To add support for a custom background.
* @uses add_editor_style() To style the visual editor.
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_custom_image_header() To add support for a custom header.
* @uses register_default_headers() To register the default custom header images provided with the theme.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
* @since Coraline 1.0
*/
function coraline_setup() {
// This theme has some pretty cool theme options
require_once ( get_template_directory() . '/inc/theme-options.php' );
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();
// Post Format support. Legacy category chooser will display in Theme Options for sites that set a category before post formats were added.
add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
// This theme uses post thumbnails
add_theme_support( 'post-thumbnails' );
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
// Make theme available for translation
// Translations can be filed in the /languages/ directory
load_theme_textdomain( 'coraline', get_template_directory() . '/languages' );
$locale = get_locale();
$locale_file = get_template_directory() . "/languages/$locale.php";
if ( is_readable( $locale_file ) )
require_once( $locale_file );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'coraline' ),
) );
// This theme allows users to set a custom background
add_custom_background();
// Your changeable header business starts here
define( 'HEADER_TEXTCOLOR', '000' );
// No CSS, just an IMG call. The %s is a placeholder for the theme template directory URI.
define( 'HEADER_IMAGE', '%s/images/headers/water-drops.jpg' );
// 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 coraline_header_image_width and coraline_header_image_height to change these values.
define( 'HEADER_IMAGE_WIDTH', apply_filters( 'coraline_header_image_width', 990 ) );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'coraline_header_image_height', 180 ) );
// 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( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
// Add a way for the custom header to be styled in the admin panel that controls
// custom headers. See coraline_admin_header_style(), below.
add_custom_image_header( 'coraline_header_style', 'coraline_admin_header_style', 'coraline_admin_header_image' );
// ... and thus ends the changeable header business.
// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
register_default_headers( array(
'water-drops' => array(
'url' => '%s/images/headers/water-drops.jpg',
'thumbnail_url' => '%s/images/headers/water-drops-thumbnail.jpg',
/* translators: header image description */
'description' => __( 'Water drops', 'coraline' )
),
'limestone-cave' => array(
'url' => '%s/images/headers/limestone-cave.jpg',
'thumbnail_url' => '%s/images/headers/limestone-cave-thumbnail.jpg',
/* translators: header image description */
'description' => __( 'Limestone cave', 'coraline' )
),
'Cactii' => array(
'url' => '%s/images/headers/cactii.jpg',
'thumbnail_url' => '%s/images/headers/cactii-thumbnail.jpg',
/* translators: header image description */
'description' => __( 'Cactii', 'coraline' )
)
) );
}
endif;
?>