-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
executable file
·97 lines (67 loc) · 2.69 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
<?php
// set a custom field prefix
define( "CMB_PREFIX", "_p_" );
// include some theme-related things
include( "library/menus.php" );
include( "library/scripts.php" );
include( "library/widgets.php" );
include( "library/button.php" );
include( "library/calculator.php" );
// an extra image manipulation function
include( "library/images.php" );
// include our metaboxes library
include( "library/metabox.php" );
include( "library/metabox-theme.php" );
// include quote metaboxes/functions
include( "library/emergency.php" );
include( "library/mobile.php" );
include( "library/showcase.php" );
include( "library/title.php" );
include( "library/icons.php" );
include( "library/promo.php" );
include( "library/accordion.php" );
include( "library/editor.php" );
include( "library/tcalc.php" );
// add support for excerpts on pages.
add_post_type_support( 'page', 'excerpt' );
// pagination
function pagination( $prev = '«', $next = '»' ) {
global $wp_query, $wp_rewrite;
$current = ( $wp_query->query_vars['paged'] > 1 ? $wp_query->query_vars['paged'] : 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' ) );
if ( is_paged() ) {
print '<div class="pagination">' . paginate_links( $pagination ) . '</div>';
}
}
// disable the whole REST API
add_filter('rest_enabled', '_return_false');
add_filter('rest_jsonp_enabled', '_return_false');
// disable RSS altogether
function disable_feeds() {
wp_redirect( home_url() );
die;
}
// Disable global RSS, RDF & Atom feeds.
add_action( 'do_feed', 'disable_feeds', -1 );
add_action( 'do_feed_rdf', 'disable_feeds', -1 );
add_action( 'do_feed_rss', 'disable_feeds', -1 );
add_action( 'do_feed_rss2', 'disable_feeds', -1 );
add_action( 'do_feed_atom', 'disable_feeds', -1 );
// Disable comment feeds.
add_action( 'do_feed_rss2_comments', 'disable_feeds', -1 );
add_action( 'do_feed_atom_comments', 'disable_feeds', -1 );
// Prevent feed links from being inserted in the <head> of the page.
add_action( 'feed_links_show_posts_feed', '__return_false', -1 );
add_action( 'feed_links_show_comments_feed', '__return_false', -1 );
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );