-
Notifications
You must be signed in to change notification settings - Fork 1
/
theme_support.php
104 lines (85 loc) · 3.12 KB
/
theme_support.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
<?php
if ( ! isset( $content_width ) ) $content_width = 1200;
register_sidebar(array(
'name' => 'Sidebar Widgets',
'id' => 'sidebar-widgets',
'description' => 'These are widgets for the sidebar.',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
/* Theme Support Function */
function jtd_theme_supports() {
$customHeaderDefaults = array(
'default-image' => get_template_directory_uri() . '/images/logo.png',
'random-default' => false,
'width' => 202,
'height' => 72,
'flex-height' => true,
'flex-width' => true,
'default-text-color' => '',
'header-text' => '',
'uploads' => true,
'wp-head-callback' => '',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'widgets' ) );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic_feed_links' );
//add_theme_support( 'custom-header', $customHeaderDefaults );
}
function register_my_menu() {
register_nav_menu( 'main-nav', __( 'Main Nav' ) );
}
function jtd_oembed_default($defaults) {
$defaults['width'] = 1160;
return $defaults;
}
function jtd_allow_rel() {
global $allowedtags;
$allowedtags['a']['rel'] = array ();
}
function jtd_browser_body_class($classes) {
global $is_IE, $is_iphone, $is_ipad;
if($is_IE) $classes[] = 'ie';
if($is_iphone) $classes[] = 'iphone';
if($is_ipad) $classes[] = 'ipad';
return $classes;
}
function jtd_category_id_class( $classes ) {
global $post;
if ( ! empty( $post ) ) {
$cats = get_the_category($post->ID);
if ( ! empty( $cats ) ) {
foreach( $cats as $cat )
$classes [] = 'cat-' . $cat->cat_ID . '-id';
}
}
return $classes;
}
/* Actions */
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'index_rel_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
add_action( 'after_setup_theme', 'jtd_theme_supports' );
add_action( 'init', 'register_my_menu' );
add_action( 'wp_loaded', 'jtd_allow_rel' );
/* Filters */
remove_filter( 'pre_user_description', 'wp_filter_kses' );
remove_filter( 'pre_comment_content', 'wp_rel_nofollow' );
add_filter( 'the_generator', '__return_false' );
add_filter( 'embed_defaults', 'jtd_oembed_default' );
add_filter( 'body_class', 'jtd_browser_body_class' );
// add_filter( 'post_class', 'jtd_category_id_class' );
// add_filter( 'body_class', 'jtd_category_id_class' );