-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfunctions.php
More file actions
387 lines (318 loc) · 11.1 KB
/
functions.php
File metadata and controls
387 lines (318 loc) · 11.1 KB
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<?php
/**
* Title: Function
*
* Description: Defines theme specific functions including actions and filters.
*
* Please do not edit this file. This file is part of the Cyber Chimps Framework and all modifications
* should be made in a child theme.
*
* @category Cyber Chimps Framework
* @package Framework
* @since 1.0
* @author CyberChimps
* @license http://www.opensource.org/licenses/gpl-license.php GPL v3.0 (or later)
* @link http://www.cyberchimps.com/
*/
// Load text domain.
function cyberchimps_text_domain() {
load_theme_textdomain( 'primo', get_template_directory() . '/inc/languages' );
add_theme_support( 'title-tag' );
}
add_action( 'after_setup_theme', 'cyberchimps_text_domain' );
// Load Core
require_once( get_template_directory() . '/cyberchimps/init.php' );
require( get_template_directory() . '/inc/admin-about.php' );
// Set the content width based on the theme's design and stylesheet.
if( !isset( $content_width ) ) {
$content_width = 640;
} /* pixels */
// Define site info
function cyberchimps_add_site_info() {
?>
<p>© Company Name</p>
<?php
}
add_action( 'cyberchimps_site_info', 'cyberchimps_add_site_info' );
if( !function_exists( 'cyberchimps_comment' ) ) :
// Template for comments and pingbacks.
// Used as a callback by wp_list_comments() for displaying the comments.
function cyberchimps_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
<li class="post pingback">
<p><?php _e( 'Pingback:', 'primo' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'primo' ), ' ' ); ?></p>
<?php
break;
default :
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<article id="comment-<?php comment_ID(); ?>" class="comment hreview">
<footer>
<div class="comment-author reviewer vcard">
<?php echo get_avatar( $comment, 40 ); ?>
<?php printf( '%s <span class="says">' . __( 'says:', 'primo' ) . '</span>', sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
</div>
<!-- .comment-author .vcard -->
<?php if( $comment->comment_approved == '0' ) : ?>
<em><?php _e( 'Your comment is awaiting moderation.', 'primo' ); ?></em>
<br/>
<?php endif; ?>
<div class="comment-meta commentmetadata">
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>" class="dtreviewed">
<time pubdate datetime="<?php comment_time( 'c' ); ?>">
<?php
/* translators: 1: date, 2: time */
printf( __( '%1$s at %2$s', 'primo' ), get_comment_date(), get_comment_time() ); ?>
</time>
</a>
<?php edit_comment_link( __( '(Edit)', 'primo' ), ' ' );
?>
</div>
<!-- .comment-meta .commentmetadata -->
</footer>
<div class="comment-content"><?php comment_text(); ?></div>
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div>
<!-- .reply -->
</article><!-- #comment-## -->
<?php
break;
endswitch;
}
endif; // ends check for cyberchimps_comment()
// set up next and previous post links for lite themes only
function cyberchimps_next_previous_posts() {
if( get_next_posts_link() || get_previous_posts_link() ): ?>
<div class="more-content">
<div class="row-fluid">
<div class="span6 previous-post">
<?php previous_posts_link(); ?>
</div>
<div class="span6 next-post">
<?php next_posts_link(); ?>
</div>
</div>
</div>
<?php
endif;
}
add_action( 'cyberchimps_after_content', 'cyberchimps_next_previous_posts' );
// core options customization Names and URL's
//Pro or Free
function cyberchimps_theme_check() {
$level = 'free';
return $level;
}
//Theme Name
function cyberchimps_options_theme_name() {
$text = 'Primo';
return $text;
}
//Theme Pro Name
function cyberchimps_upgrade_bar_pro_title() {
$text = 'Primo Pro';
return $text;
}
//Upgrade link
function cyberchimps_upgrade_bar_pro_link() {
$url = 'http://cyberchimps.com/store/primo-pro/';
return $url;
}
//Doc's URL
function cyberchimps_options_documentation_url() {
$url = 'http://cyberchimps.com/guides/c/';
return $url;
}
// Support Forum URL
function cyberchimps_options_support_forum() {
$url = 'http://cyberchimps.com/forum/free/primo/';
return $url;
}
add_filter( 'cyberchimps_current_theme_name', 'cyberchimps_options_theme_name', 1 );
add_filter( 'cyberchimps_upgrade_pro_title', 'cyberchimps_upgrade_bar_pro_title' );
add_filter( 'cyberchimps_upgrade_link', 'cyberchimps_upgrade_bar_pro_link' );
add_filter( 'cyberchimps_documentation', 'cyberchimps_options_documentation_url' );
add_filter( 'cyberchimps_support_forum', 'cyberchimps_options_support_forum' );
// Help Section
function cyberchimps_options_help_header() {
$text = 'Primo';
return $text;
}
function cyberchimps_options_help_sub_header() {
$text = __( 'Primo Professional Responsive WordPress Theme', 'primo' );
return $text;
}
add_filter( 'cyberchimps_help_heading', 'cyberchimps_options_help_header' );
add_filter( 'cyberchimps_help_sub_heading', 'cyberchimps_options_help_sub_header' );
//theme specific skin options in array. Must always include option default
function cyberchimps_skin_color_options( $options ) {
// Get path of image
$imagepath = get_template_directory_uri() . '/inc/css/skins/images/';
$options = array(
'default' => $imagepath . 'default.png'
);
return $options;
}
add_filter( 'cyberchimps_skin_color', 'cyberchimps_skin_color_options' );
// theme specific background images
function cyberchimps_background_image( $options ) {
$imagepath = get_template_directory_uri() . '/cyberchimps/lib/images/';
$options = array(
'none' => $imagepath . 'backgrounds/thumbs/none.png',
'noise' => $imagepath . 'backgrounds/thumbs/noise.png',
'blue' => $imagepath . 'backgrounds/thumbs/blue.png',
'dark' => $imagepath . 'backgrounds/thumbs/dark.png',
'space' => $imagepath . 'backgrounds/thumbs/space.png'
);
return $options;
}
add_filter( 'cyberchimps_background_image', 'cyberchimps_background_image' );
// theme specific typography options
function cyberchimps_typography_sizes( $sizes ) {
$sizes = array( '8', '9', '10', '12', '14', '16', '20' );
return $sizes;
}
function cyberchimps_typography_styles( $styles ) {
$styles = array( 'normal' => 'Normal', 'bold' => 'Bold' );
return $styles;
}
function cyberchimps_typography_faces( $orig ) {
$new = array(
'"Trocchi", Times, serif' => 'Trocchi',
'"Quattrocento Sans", Times, serif' => 'Quattrocento'
);
$new = array_merge( $new, $orig );
return $new;
}
function cyberchimps_typography_defaults() {
$default = array(
'size' => '14px',
'face' => '"Quattrocento Sans", Times, serif',
'style' => 'normal',
'color' => '#555555'
);
return $default;
}
function cyberchimps_typography_heading_defaults() {
$default = array(
'size' => '',
'face' => '"Trocchi", Times, serif',
'style' => '',
'color' => '',
);
return $default;
}
add_filter( 'cyberchimps_typography_sizes', 'cyberchimps_typography_sizes' );
add_filter( 'cyberchimps_typography_styles', 'cyberchimps_typography_styles' );
add_filter( 'cyberchimps_typography_faces', 'cyberchimps_typography_faces' );
add_filter( 'cyberchimps_typography_defaults', 'cyberchimps_typography_defaults' );
add_filter( 'cyberchimps_typography_heading_defaults', 'cyberchimps_typography_heading_defaults' );
// Default for twitter bar handle
function cyberchimps_twitter_handle_filter() {
return 'WordPress';
}
add_filter( 'cyberchimps_twitter_handle_filter', 'cyberchimps_twitter_handle_filter' );
function primo_customize_edit_links( $wp_customize ) {
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title a'
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.top-head-description'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[custom_logo]', array(
'selector' => '#logo'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[theme_backgrounds]', array(
'selector' => '#social'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[searchbar]', array(
'selector' => '#navigation #searchform'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[footer_show_toggle]', array(
'selector' => '#footer_wrapper'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[footer_copyright_text]', array(
'selector' => '#copyright'
) );
$wp_customize->selective_refresh->add_partial( 'nav_menu_locations[primary]', array(
'selector' => '#navigation .nav'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[blog_title]', array(
'selector' => '.page-title'
) );
$wp_customize->selective_refresh->add_partial( 'cyberchimps_options[footer_show_toggle]', array(
'selector' => '#footer-widget-container'
) );
}
add_action( 'customize_register', 'primo_customize_edit_links' );
add_theme_support( 'customize-selective-refresh-widgets' );
add_action( 'admin_notices', 'radiant_admin_notices' );
function radiant_admin_notices()
{
$admin_check_screen = get_admin_page_title();
if( !class_exists('SlideDeckPlugin') )
{
$plugin='slidedeck/slidedeck.php';
$slug = 'slidedeck';
$installed_plugins = get_plugins();
if ( $admin_check_screen == 'Manage Themes' || $admin_check_screen == 'Theme Options Page' )
{
?>
<div class="notice notice-info is-dismissible" style="margin-top:15px;">
<p>
<?php if( isset( $installed_plugins[$plugin] ) )
{
?>
<a href="<?php echo admin_url( 'plugins.php' ); ?>">Activate the SlideDeck Lite plugin</a>
<?php
}
else
{
?>
<a href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug ); ?>">Install the SlideDeck Lite plugin</a>
<?php } ?>
</p>
</div>
<?php
}
}
if( !class_exists('WPForms') )
{
$plugin = 'wpforms-lite/wpforms.php';
$slug = 'wpforms-lite';
$installed_plugins = get_plugins();
if ( $admin_check_screen == 'Manage Themes' || $admin_check_screen == 'Theme Options Page' )
{
?>
<div class="notice notice-info is-dismissible" style="margin-top:15px;">
<p>
<?php if( isset( $installed_plugins[$plugin] ) )
{
?>
<a href="<?php echo admin_url( 'plugins.php' ); ?>">Activate the WPForms Lite plugin</a>
<?php
}
else
{
?>
<a href="<?php echo wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $slug ), 'install-plugin_' . $slug ); ?>">Install the WP Forms Lite plugin</a>
<?php } ?>
</p>
</div>
<?php
}
}
if ( $admin_check_screen == 'Manage Themes' || $admin_check_screen == 'Theme Options Page' )
{
?>
<div class="notice notice-success is-dismissible">
<b><p>Liked this theme? <a href="https://wordpress.org/support/theme/primo-lite/reviews/#new-post" target="_blank">Leave us</a> a ***** rating. Thank you! </p></b>
</div>
<?php
}
}