-
Notifications
You must be signed in to change notification settings - Fork 7
/
functions.php
executable file
·172 lines (141 loc) · 4.86 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
/**
* Symbol functions and definitions
*
* @package Symbol
* @since Symbol 1.0
*/
/**
* Set the content width based on the theme's design and stylesheet.
*
* @since Symbol 1.0
*/
if ( ! isset( $content_width ) )
$content_width = 640; /* pixels */
if ( ! function_exists( 'symbol_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 post thumbnails.
*
* @since Symbol 1.0
*/
function symbol_setup() {
/**
* 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/tweaks.php' );
/**
* Including menu images
*/
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support( 'automatic-feed-links' );
/**
* Enable support for Post Thumbnails
*/
add_theme_support( 'post-thumbnails' );
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'symbol' ),
) );
}
endif; // symbol_setup
add_action( 'after_setup_theme', 'symbol_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since Symbol 1.0
*/
function symbol_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'symbol' ),
'id' => 'sidebar-1',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
}
add_action( 'widgets_init', 'symbol_widgets_init' );
/**
* Enqueue scripts and styles
*/
function symbol_scripts() {
wp_enqueue_style( 'normalize', '//normalize-css.googlecode.com/svn/trunk/normalize.css');
wp_enqueue_style( 'prettify', '//google-code-prettify.googlecode.com/svn/trunk/src/prettify.css');
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js');
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'snap-js', get_template_directory_uri() . '/js/snap.min.js', array('jquery'), '20130115', true );
wp_enqueue_script( 'prettify', '//google-code-prettify.googlecode.com/svn/trunk/src/prettify.js', array( ), '20120206', true );
wp_enqueue_script( 'site-js', get_template_directory_uri() . '/js/site.js', array( 'jquery', 'prettify', 'snap-js'), '20120206', true );
}
add_action( 'wp_enqueue_scripts', 'symbol_scripts' );
add_action('admin_head', 'load_theme_scripts');
function of_stylesheet() {
global $theme_options;
$themename = get_option( 'stylesheet' );
$themename = preg_replace("/\W/", "_", strtolower($themename) );
$theme_options = get_option ($themename);
$color = $theme_options['site_color'];
?>
<style type="text/css">
body{
color: <?php echo $theme_options['text_color']; ?>
}
h1,h2,h3,h4,h5,h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a{
color: <?php echo $theme_options['titles_color']; ?>
}
#page{
background-color: <?php echo $theme_options['background']['color'] ?>;
background-image: url(<?php echo $theme_options['background']['image'] ?>);
background-repeat: <?php echo $theme_options['background']['repeat'] ?>;
background-attachment: <?php echo $theme_options['background']['attachment'] ?>;
}
header.site-header h1 a {
background-image: url(<?php echo $theme_options['header_background_image'] ?>);
}
header.site-header nav {
background: <?php echo $theme_options['navigation_background_color'] ?>;
}
header.site-header nav ul li a{
color: <?php echo $theme_options['navigation_text_color'] ?>;
}
article blockquote,
article .entry-content a:hover,
article a:hover,
.wrap nav a:hover, #page
{border-color: <?php echo $color ?>;}
article h1 a:hover { color: <?php echo $color ?>}
nav.pagination a:hover,
#respond #submit, ::selection
{background-color: <?php echo $color ?>;}
<?php if($color): ?>
header.site-header h1.site-title a{background-color: <?php echo $color ?>;}
<?php endif; ?>
<?php if (get_header_image()): ?>
header.site-header h1.site-title a{background-image: url(<?php echo get_header_image() ?> );}
<?php endif ?>
</style>
<?php
}
add_action( 'wp_head', 'of_stylesheet' );
// Re-define the options-framework URL
define( 'OPTIONS_FRAMEWORK_URL', get_template_directory_uri() . '/inc/options-framework/' );
// Load the Options Framework Plugin
if ( !function_exists( 'optionsframework_init' ) ) {
define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory() . '/inc/options-framework/' );
require_once OPTIONS_FRAMEWORK_DIRECTORY . 'options-framework.php';
}
require get_template_directory() . '/inc/Theme-Updater/updater.php';