-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
97 lines (83 loc) · 2.52 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
<?php
// Let's cleanup a little and remove things we don't need
remove_action('wp_head', 'wp_generator');
function tge_hide_version() {
return '';
}
add_filter('the_generator', 'tge_hide_version');
// Scripts and styles we want
function tge_scripts_styles() {
// Main style sheet
wp_enqueue_style('tge-style', get_stylesheet_uri());
// jQuery in noConflict mode
wp_enqueue_script('jquery');
// Typekit
wp_enqueue_script('typekit-font', '//use.typekit.net/afi6dbc.js', array(), null, true);
// The Giant Eye custom js
wp_enqueue_script('tge-custom', get_template_directory_uri() . '/js/tge.js', array('jquery'), null, true);
}
add_action('wp_enqueue_scripts', 'tge_scripts_styles');
// Init action
function tge_init() {
// Create our custom menus
register_nav_menus(
array(
'social-menu' => __('Social Media Menu', 'tge-theme'),
)
);
// And our custom post types
register_post_type('footer_posts',
array(
'labels' => array(
'name' => __('Footer Posts', 'tge-theme'),
'singular_name' => __('Footer Post', 'tge-theme')
),
'public' => true,
'has_archive' => false,
'exclude_from_search' => true,
'show_in_menu' => true,
'menu_position' => 21,
'capability_type' => 'page',
'hierarchical' => true,
'supports' => array(
'title',
'editor',
'page-attributes',
),
)
);
// Some image sizes that we need
// 745 pixels wide (and unlimited height)
add_image_size('post_regular', 745);
// 455 pixels wide (and unlimited height)
add_image_size('post_floated', 455);
// 420x420 and cropped image
add_image_size('geek_portrait', 420, 420, true);
}
add_action('init', 'tge_init');
// Image sizes should be selectable in the Media library as well
function tge_custom_sizes($sizes) {
return array_merge($sizes, array(
'post_regular' => __('Post Regular (745px)', 'tge-theme'),
'post_floated' => __('Post Floated (455px)', 'tge-theme'),
));
}
add_filter('image_size_names_choose', 'tge_custom_sizes');
// Theme setup
function tge_setup() {
// Adds RSS feed links to <head> for posts and comments.
add_theme_support('automatic-feed-links');
// Featured image, crop it to 16:9, hard crop from center center
add_theme_support('post-thumbnails');
set_post_thumbnail_size(960, 544, array('center', 'center'));
}
add_action('after_setup_theme', 'tge_setup');
// Helper function for our SVG icons
function tge_icon($icon) {
$svg = NULL;
$path = dirname(__FILE__) . '/images/icons/' . $icon . '.svg';
if(file_exists($path)) {
$svg = file_get_contents($path);
}
return $svg;
}