This repository has been archived by the owner on Aug 27, 2019. It is now read-only.
/
functions.php
93 lines (74 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
<?php
function tkuim_setup(){
load_theme_textdomain('tkuim', get_template_directory() . '/languages');
add_theme_support('automatic-feed-links');
add_theme_support('title-tag');
// add_theme_support('post-formats', array(
// 'aside',
// 'image',
// 'video',
// 'quote',
// 'link',
// 'gallery',
// 'status',
// 'audio',
// 'chat',
// ));
add_theme_support('post-thumbnails');
add_theme_support('html5', array(
'comment-list',
'comment-form',
'search-form',
'gallery',
'caption'
));
// add_editor_style( array( 'css/editor-style.css', twentysixteen_fonts_url() ) );
register_nav_menus(array(
'primary' => __('Primary menu', 'tkuim'),
'top' => __('Top menu', 'tkuim'),
'footer' => __('Footer menu', 'tkuim')
));
}
add_action('after_setup_theme', 'tkuim_setup');
function tkuim_widgets_init(){
register_sidebar(array(
'name' => __('Sidebar', 'tkuim'),
'id' => 'sidebar-1',
'description' => __('Add widgets here to appear in your sidebar.', 'tkuim'),
'before_widget' => '<section id="%1$s" class="sidebar__widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="sidebar__widget-title">',
'after_title' => '</h2>',
));
}
add_action('widgets_init', 'tkuim_widgets_init');
function tkuim_scripts(){
wp_enqueue_style('tkuim-fontawesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), '4.5.0');
wp_enqueue_style('tkuim-style', get_stylesheet_uri(), array(), '1.0.0');
wp_enqueue_script('tkuim-html5', get_template_directory_uri() . '/js/html5.js', array(), '3.7.3');
wp_script_add_data('tkuim-html5', 'conditional', 'lt IE 9');
}
add_action('wp_enqueue_scripts', 'tkuim_scripts');
function tkuim_custom_header_setup(){
add_theme_support('custom-header', apply_filters('tkuim_custom_header_args', array(
'default-text-color' => 'fff',
'width' => 1000,
'height' => 250,
'flex-height' => true,
'header-text' => false
)));
}
add_action('after_setup_theme', 'tkuim_custom_header_setup');
function tkuim_per_get_posts($query){
if (is_admin() || !$query->is_main_query()) return;
if (is_post_type_archive('teacher') || is_tax('teacher-type')){
$query->set('nopaging', true);
$query->set('orderby', 'menu_order');
$query->set('order', 'ASC');
}
}
add_action('pre_get_posts', 'tkuim_per_get_posts', 1);
function tkuim_get_post_thumbnail(){
$thumbs = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium_large');
return $thumbs[0];
}