This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cornerstone/functions.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
199 lines (162 sloc)
5.79 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* cornerstone functions and definitions | |
* | |
* @package cornerstone | |
*/ | |
/** | |
* Set the content width based on the theme's design and stylesheet. | |
*/ | |
if ( ! isset( $content_width ) ) { | |
$content_width = 640; /* pixels */ | |
} | |
if ( ! function_exists( 'cs_setup' ) ) : | |
/** | |
* Sets up theme defaults and registers support for various WordPress features. | |
* | |
* Note that this function is hooked into the after_setup_theme hook, which | |
* runs before the init hook. The init hook is too late for some features, such | |
* as indicating support for post thumbnails. | |
*/ | |
function cs_setup() { | |
/* | |
* Make theme available for translation. | |
* Translations can be filed in the /languages/ directory. | |
* If you're building a theme based on cornerstone, use a find and replace | |
* to change 'cs' to the name of your theme in all the template files | |
*/ | |
load_theme_textdomain( 'cs', get_template_directory() . '/languages' ); | |
// Add default posts and comments RSS feed links to head. | |
add_theme_support( 'automatic-feed-links' ); | |
/* | |
* Enable support for Post Thumbnails on posts and pages. | |
* | |
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails | |
*/ | |
//add_theme_support( 'post-thumbnails' ); | |
// This theme uses wp_nav_menu() in one location. | |
register_nav_menus( array( | |
'primary' => __( 'Primary Menu', 'cs' ), | |
) ); | |
// Enable support for Post Formats. | |
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); | |
// Setup the WordPress core custom background feature. | |
add_theme_support( 'custom-background', apply_filters( 'cs_custom_background_args', array( | |
'default-color' => 'ffffff', | |
'default-image' => '', | |
) ) ); | |
// Enable support for HTML5 markup. | |
add_theme_support( 'html5', array( | |
'comment-list', | |
'search-form', | |
'comment-form', | |
'gallery', | |
'caption', | |
) ); | |
} | |
endif; // cs_setup | |
add_action( 'after_setup_theme', 'cs_setup' ); | |
/** | |
* Register widget area. | |
* | |
* @link http://codex.wordpress.org/Function_Reference/register_sidebar | |
*/ | |
function cs_widgets_init() { | |
require get_template_directory() . '/inc/reg-sidebars.php'; | |
} | |
add_action( 'widgets_init', 'cs_widgets_init' ); | |
/** | |
* Enqueue scripts and styles. | |
*/ | |
function cs_scripts() { | |
wp_enqueue_style( 'cs-style', get_stylesheet_uri()); | |
wp_enqueue_script( 'cs-bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' )); | |
wp_enqueue_script( 'cs-modernizr', get_template_directory_uri() . '/js/cs-modernizr.js', array( 'jquery' )); | |
wp_enqueue_script( 'cs', get_template_directory_uri() . '/js/cs.js', array( 'jquery' )); | |
wp_enqueue_script( 'cs-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'cs-bootstrap-js'), '20120206', true ); | |
wp_enqueue_script( 'cs-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true ); | |
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { | |
wp_enqueue_script( 'comment-reply' ); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'cs_scripts' ); | |
function htmlShiv(){ | |
$template = get_template_directory_uri(); | |
echo '<!--[if lt IE 9]> | |
<script src="' . $template . '/js/html5shiv/html5shiv.min.js"></script> | |
<script src="' . $template . '/js/html5shiv/html5shiv-printshiv.min.js"></script> | |
<![endif]-->'; | |
//needed for IE7 grid hack | |
/*echo '<!--[if lt IE 8]> | |
<link href="'. $template .'/css/bootstrap.css" rel="stylesheet"> | |
<![endif]-->'; */ | |
} | |
add_action( 'wp_head', htmlShiv, 1 ); | |
function ieBootstrap(){ | |
$template = get_template_directory_uri(); | |
echo '<!--[if lt IE 9]> | |
<script src="' . $template . '/js/respond.min.js"></script> | |
<![endif]-->'; | |
/* | |
echo '<!--[if lt IE 8]> | |
<link href="'. $template .'/css/bootstrap-ie7.css.php" rel="stylesheet"> | |
<![endif]-->'; | |
*/ | |
} | |
add_action( 'wp_head', ieBootstrap, 99 ); | |
/** | |
* Implement the Custom Header feature. | |
*/ | |
require get_template_directory() . '/inc/custom-header.php'; | |
/** | |
* Custom template tags for this theme. | |
*/ | |
require get_template_directory() . '/inc/template-tags.php'; | |
/** | |
* Custom functions that act independently of the theme templates. | |
*/ | |
require get_template_directory() . '/inc/extras.php'; | |
/** | |
* Customizer additions. | |
*/ | |
require get_template_directory() . '/inc/customizer.php'; | |
/** | |
* Load Jetpack compatibility file. | |
*/ | |
//require get_template_directory() . '/inc/jetpack.php'; | |
/** | |
* New versions of functions from Hale, added as includes | |
*/ | |
require get_template_directory() . '/inc/nav-walker.php'; | |
/** | |
* Bootstrap the comment form. | |
*/ | |
require get_template_directory() . '/inc/bootstrap-forms.php'; | |
// Change what's hidden by default | |
add_filter('default_hidden_meta_boxes', 'be_hidden_meta_boxes', 10, 2); | |
function be_hidden_meta_boxes($hidden, $screen) { | |
if ( 'post' == $screen->base || 'page' == $screen->base ) | |
$hidden = array('slugdiv', 'trackbacksdiv', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv'); | |
// removed 'postcustom', | |
return $hidden; | |
} | |
function load_custom_wp_admin_style() { | |
wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/css/admin-style.css', false, '1.0.0' ); | |
wp_enqueue_style( 'custom_wp_admin_css' ); | |
wp_register_script('uc-admin-js', get_template_directory_uri() . '/js/admin-style.js', false, '1.0.0'); | |
wp_enqueue_script('uc-admin-js'); | |
} | |
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' ); | |
/* | |
function remove_widgets() { | |
// removed to avoid confusion with UConn Calendar widget | |
unregister_widget('WP_Widget_Calendar'); | |
// removed to de-emphasize blog use | |
unregister_widget('WP_Widget_Recent_Comments'); | |
unregister_widget('WP_Widget_Meta'); | |
// removed for conflict with simple social plugin on IE9 | |
unregister_widget('WP_Widget_Categories'); | |
} | |
add_action( 'widgets_init', 'remove_widgets' ); | |
*/ | |
add_theme_support( 'post-thumbnails' ); |