forked from crowdfavorite/wp-carrington-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
146 lines (125 loc) · 4.28 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
// This file is part of the Carrington Blueprint Theme for WordPress
//
// Copyright (c) 2008-2012 Crowd Favorite, Ltd. All rights reserved.
// http://crowdfavorite.com
//
// Released under the GPL license
// http://www.opensource.org/licenses/gpl-license.php
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// **********************************************************************
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die(); }
define('CFCT_PATH', trailingslashit(TEMPLATEPATH));
/**
* Set this to "true" to turn on debugging mode.
* Helps with development by showing the paths of the files loaded by Carrington.
*/
define('CFCT_DEBUG', false);
/**
* Theme version.
*/
define('CFCT_THEME_VERSION', '0.1');
/**
* Theme URL version.
* Added to query var at the end of assets to force browser cache to reload after upgrade.
*/
if (!(defined('CFCT_URL_VERSION'))) {
define('CFCT_URL_VERSION', '0.1');
}
/**
* Includes
*/
include_once(CFCT_PATH.'carrington-core/carrington.php');
/**
* Set the content width based on the theme's design and stylesheet.
*/
if (! isset($content_width)) {
$content_width = 600;
}
/**
* 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 post thumbnails.
*/
if (! function_exists('cfct_theme_setup')) {
function cfct_theme_setup() {
/**
* Make theme available for translation
* Use find and replace to change 'carrington-blueprint' to the name of your theme.
*/
load_theme_textdomain('carrington-blueprint');
/**
* Add default posts and comments RSS feed links to head.
*/
add_theme_support('automatic-feed-links');
/**
* Enable post thumbnails support.
*/
add_theme_support('post-thumbnails');
/**
* New image sizes that are not overwrote in the admin.
*/
// add_image_size('thumb-img', 160, 120, true);
// add_image_size('medium-img', 510, 510, false);
// add_image_size('large-img', 710, 700, false);
/**
* Add navigation menus
*/
register_nav_menus(array(
'main' => 'Main Navigation',
'footer' => 'Footer Navigation'
));
/**
* Add post formats
*/
// add_theme_support( 'post-formats', array('image', 'link', 'gallery', 'quote', 'status', 'video'));
}
}
add_action('after_setup_theme', 'cfct_theme_setup');
/**
* Register widgetized area and update sidebar with default widgets.
*/
function cfct_widgets_init() {
// Sidebar Defaults
$sidebar_defaults = array(
'before_widget' => '<aside id="%1$s" class="widget clearfix %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>'
);
// Copy the following code and replace values to create more widget areas
register_sidebar(array_merge($sidebar_defaults, array(
'id' => 'sidebar-default',
'name' => __('Default Sidebar', 'carrington-blueprint'),
)));
}
add_action( 'widgets_init', 'cfct_widgets_init' );
/**
* Enqueue's scripts and styles
*/
function cfct_load_assets() {
//Variable for assets url
$cfct_assets_url = get_template_directory_uri() . '/assets/';
// Styles
wp_register_style('base', $cfct_assets_url . 'css/base.css', '', CFCT_URL_VERSION);
wp_enqueue_style('base');
wp_register_style('grid', $cfct_assets_url . 'css/grid.css', 'base', CFCT_URL_VERSION);
wp_enqueue_style('grid');
wp_register_style('content', $cfct_assets_url . 'css/content.css', 'grid', CFCT_URL_VERSION);
wp_enqueue_style('content');
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Scripts
wp_enqueue_script('modernizr', $cfct_assets_url . 'js/modernizr-2.5.3.min.js', '', CFCT_URL_VERSION);
wp_enqueue_script('jquery');
wp_enqueue_script('placeholder', $cfct_assets_url . 'js/jquery.placeholder.min.js', 'jquery', CFCT_URL_VERSION);
wp_enqueue_script('script', $cfct_assets_url . 'js/script.js', array('jquery', 'placeholder'), CFCT_URL_VERSION);
}
add_action('wp_enqueue_scripts', 'cfct_load_assets');