-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
130 lines (120 loc) · 4.34 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
<?php
// Control and Output for Customizer
get_template_part( 'inc/customizer/control' );
get_template_part( 'inc/customizer/output' );
// CSS generator function for output
function generate_css( $selector, $style, $mod_name, $prefix='', $postfix='', $echo=true ) {
$return = '';
$mod = get_option($mod_name);
if ( ! empty( $mod ) ) {
$return = sprintf('%s { %s:%s; }',
$selector,
$style,
$prefix.$mod.$postfix
);
if ( $echo ) {
echo $return . "\r\n";
}
}
return $return;
}
// Enqueue scripts
function theme_scripts() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', array(), null, false );
wp_enqueue_script( 'jquery' );
wp_enqueue_style( 'theme-style', get_stylesheet_uri() );
wp_enqueue_style( 'google-fonts', 'http://fonts.googleapis.com/css?family=Oxygen|Radley:300,700' );
wp_enqueue_script( 'script', get_template_directory_uri() . '/js/script.js' );
wp_register_script( 'hover', get_template_directory_uri() . '/js/jquery.hoverIntent.minified.js', array(), null, false );
wp_enqueue_script( 'hover' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'theme_scripts' );
if ( ! function_exists( 'theme_setup' ) ) {
function theme_setup() {
register_sidebar(array(
'name' => 'Sidebar Widgets',
'id' => 'sidebar-widgets',
'description' => 'Widgets for the sidebar.',
'before_widget' => '<div class="aside widget %2$s clear" id="%1$s">',
'after_widget' => '</div>'
));
register_sidebar(array(
'name' => 'Footer Left Widgets',
'id' => 'footer-left-widgets',
'description' => 'Widgets for the left footer column.',
'before_widget' => '<div class="aside widget %2$s clear" id="%1$s">',
'after_widget' => '</div>'
));
register_sidebar(array(
'name' => 'Footer Center Widgets',
'id' => 'footer-center-widgets',
'description' => 'Widgets for the center footer column.',
'before_widget' => '<div class="aside widget %2$s clear" id="%1$s">',
'after_widget' => '</div>'
));
register_sidebar(array(
'name' => 'Footer Right Widgets',
'id' => 'footer-right-widgets',
'description' => 'Widgets for the right footer column.',
'before_widget' => '<div class="aside widget %2$s clear" id="%1$s">',
'after_widget' => '</div>'
));
}
}
add_action( 'after_setup_theme', 'theme_setup' );
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'primary' => __( 'Primary' ),
));
}
// Custom comments loop
function regent_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'div' == $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
<<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
<?php if ( 'div' != $args['style'] ) : ?>
<div id="div-comment-<?php comment_ID() ?>" class="comment-body">
<?php endif; ?>
<div class="comment-table">
<div class="comment-author vcard">
<?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
<?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?>
</div>
<div class="spacer"></div>
<div class="comment-box">
<div class="comment-triangle"></div>
<?php if ($comment->comment_approved == '0') : ?>
<em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
<br />
<?php endif; ?>
<div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
<?php
/* translators: 1: date, 2: time */
printf( __('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),' ','' );
?>
</div>
<?php comment_text() ?>
</div><!-- .comment-box -->
</div><!-- .clear -->
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
<?php if ( 'div' != $args['style'] ) : ?>
</div>
<?php endif; ?>
<?php
}