-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
85 lines (67 loc) · 2.75 KB
/
functions.php
File metadata and controls
85 lines (67 loc) · 2.75 KB
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
<?php
function pageBanner($args = NULL) {
if (!isset($args['title'])) {
$args['title'] = get_the_title();
}
if (!isset($args['subtitle'])) {
$args['subtitle'] = get_field('page_banner_subtitle');
}
if (!isset($args['photo'])) {
if (get_field('page_banner_background_image') AND !is_archive() AND !is_home() ) {
$args['photo'] = get_field('page_banner_background_image')['sizes']['pageBanner'];
} else {
$args['photo'] = get_theme_file_uri('/images/ocean.jpg');
}
}
?>
<div class="page-banner">
<div class="page-banner__bg-image" style="background-image: url(<?php echo $args['photo']; ?>);"></div>
<div class="page-banner__content container container--narrow">
<h1 class="page-banner__title"><?php echo $args['title'] ?></h1>
<div class="page-banner__intro">
<p><?php echo $args['subtitle'] ?></p>
</div>
</div>
</div>
<?php }
function enqueue_university_files() {
// Enqueue scripts
wp_enqueue_script('university_main-scripts', get_template_directory_uri() . '/build/index.js', array(), '1.0.0', true);
wp_enqueue_style('theme-style', get_stylesheet_uri());
// Enqueue styles
wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
wp_enqueue_style('university_main-styles', get_template_directory_uri() . '/build/style-index.css');
wp_enqueue_style('university_custom-styles', get_template_directory_uri() . '/build/index.css');
wp_enqueue_style('custom-google-fonts', '//fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i|Roboto:100,300,400,400i,700,700i');
}
add_action('wp_enqueue_scripts', 'enqueue_university_files');
function university_features() {
add_theme_support('title-tag');
add_theme_support('post-thumbnails');
add_image_size('professorLandscape', 400, 260, true);
add_image_size('professorPortrait', 480, 650, true);
add_image_size('pageBanner', 1500, 350, true);
}
add_action('after_setup_theme', 'university_features');
function university_adjust_queries($query) {
if (!is_admin() AND is_post_type_archive('program') AND is_main_query()) {
$query->set('orderby', 'title');
$query->set('order', 'ASC');
$query->set('posts_per_page', -1);
}
if (!is_admin() AND is_post_type_archive('event') AND $query->is_main_query()) {
$today = date('Ymd');
$query->set('meta_key', 'event_date');
$query->set('orderby', 'meta_value_num');
$query->set('order', 'ASC');
$query->set('meta-query', array (
array(
'key' => 'event_date',
'compare' => '>=',
'value' => $today,
'type' => 'numeric'
),
));
}
}
add_action('pre_get_posts', 'university_adjust_queries');