-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
84 lines (50 loc) · 1.9 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
<?php
// set a custom field prefix
define( "CMB_PREFIX", "_p_" );
// include some theme-related things
include( "library/menus.php" );
include( "library/scripts.php" );
// post types
include( "library/post-type/partner.php" );
// an extra image manipulation function
include( "library/images.php" );
// include our metaboxes library
include( "library/metabox.php" );
include( "library/metabox-theme.php" );
// include widget library
include( "library/widgets.php" );
include( "library/login.php" );
// include quote metaboxes/functions
include( "library/title.php" );
include( "library/showcase.php" );
include( "library/accordion.php" );
// widgets
include( "library/twitter-aggregator/widget.php" );
// interstitial
include( "library/interstitial.php" );
// [anchor] shortcode
function p_anchor( $atts, $content = null, $code = "" ) {
return '<a name="'.$content.'"></a>';
}
add_shortcode('anchor' , 'p_anchor' );
// enable oembed and shortcodes in text widgets
add_filter( 'widget_text', array( $wp_embed, 'run_shortcode' ), 8 );
add_filter( 'widget_text', array( $wp_embed, 'autoembed'), 8 );
// pagination
function pagination($prev = '«', $next = '»') {
global $wp_query, $wp_rewrite;
$wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
$pagination = array(
'base' => @add_query_arg('paged','%#%'),
'format' => '',
'total' => $wp_query->max_num_pages,
'current' => $current,
'prev_text' => __($prev),
'next_text' => __($next),
'type' => 'plain'
);
if ( $wp_rewrite->using_permalinks() ) $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
if ( !empty($wp_query->query_vars['s']) ) $pagination['add_args'] = array( 's' => get_query_var( 's' ) );
echo paginate_links( $pagination );
}
?>