-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.php
116 lines (90 loc) · 3.42 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
<?php
define( 'INCLUDES', get_template_directory() . DS . 'includes' );
//RSS Feed Support
add_theme_support( 'automatic-feed-links' );
// add custom class to tag link
function add_class_the_tags($html){
$html = str_replace('<a','<a class="tags"',$html);
return $html;
}
add_filter('the_tags','add_class_the_tags');
// add custom class to category link
function add_class_the_categories( $html ) {
$html = str_replace( '<a', '<a class="categories"', $html );
return $html;
}
add_filter( 'the_category', 'add_class_the_categories' );
//Post thumbnails support
add_theme_support( 'post-thumbnails' );
add_image_size( 'single-post-thumbnail', 2000, 1125 ); // Increased the default size of the thumbnail slightly for larger browsers.
the_post_thumbnail( 'full', 0, 0 ); // DISABLED Full resolution (original size uploaded)
the_post_thumbnail( 'thumbnail', 960, 540 ); // Thumbnail for use in posts
the_post_thumbnail( 'medium', 0, 0 ); // DISABLED Medium resolution (default 300px x 300px max)
the_post_thumbnail( 'large', 0, 0 ); // DISABLED Large resolution (default 640px x 640px max)
// Next and previous post links class
add_filter('next_posts_link_attributes', 'posts_link_attributes_1');
add_filter('previous_posts_link_attributes', 'posts_link_attributes_2');
function posts_link_attributes_1() {
return 'class="button newer-button"';
}
function posts_link_attributes_2() {
return 'class="button older-button"';
}
// S3 Urls
add_filter( 'wp_get_attachment_url', 's3Url' );
function s3Url($url) {
$blogInfo = get_site( get_current_blog_id() );
$subsitePath = 'wp-content/uploads';
list($sub, $domain, $tld) = explode('.', $blogInfo->domain);
// the s3 plugin that is currently used stores files under the domain
$subsitePath = $sub.'/files';
$uploadpaths = wp_upload_dir();
$path = $subsitePath . str_replace($uploadpaths['baseurl'], '', $url);
$downloadDistribution = get_option( 's3_download' );
$bucket = get_option( 's3_bucket' );
$url = 'http://'.$bucket.'.s3.amazonaws.com/'.$path;
if (!empty($downloadDistribution) && !is_admin()) {
$url = "http://$downloadDistribution/$path";
}
return $url;
}
//Add Post Formats (limit to these types)
add_theme_support( 'post-formats', array( 'video', 'quote', 'audio' ) );
//Options Pages Added
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Main Menu',
'menu_title' => 'Main Menu',
'menu_slug' => 'main_menu',
'redirect' => false
));
acf_add_options_page(array(
'page_title' => 'Footer',
'menu_title' => 'Footer',
'menu_slug' => 'footer',
'redirect' => false
));
acf_add_options_page(array(
'page_title' => 'Other Options',
'menu_title' => 'Other Options',
'menu_slug' => 'other_options',
'redirect' => false
));
}
// Add admin menu options
if ( is_admin() ) {
require_once INCLUDES . DS . 'admin.php';
}
//ALLOW .SVG File Type For Logos and Graphics
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
// Add CSS Styles to Visual Editor so user can see output while editing.
add_editor_style('/css/rockharbor-stories.webflow.css');
add_editor_style('/style.css');
// Add AJAX handler for retrieving additional posts
require_once INCLUDES . DS . 'ajax-frontpage.php';
add_action( 'wp_ajax_nopriv_fetch_posts', 'ajaxFetchPosts' );
add_action( 'wp_ajax_fetch_posts', 'ajaxFetchPosts' );