-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
117 lines (96 loc) · 3.21 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
117
<?php
# Enquueue Scrips and Styles
function cthulhupark_theme_styles() {
wp_enqueue_style( 'cthulhupark', get_template_directory_uri().'/style.css', array(), 1.0, 'screen, print' );
wp_enqueue_script( 'cthulhupark-main', get_template_directory_uri() . '/js/cthulhupark-main.js', array(), 1.0, true);
wp_enqueue_script( 'wp-api' );
}
add_action( 'wp_enqueue_scripts', 'cthulhupark_theme_styles' );
# Activate ACF Filters
// Enable the option show in rest
add_filter( 'acf/rest_api/field_settings/show_in_rest', '__return_true' );
// Enable the option edit in rest
add_filter( 'acf/rest_api/field_settings/edit_in_rest', '__return_true' );
# Change Excerpt length
function custom_excerpt_length( $length ) {
return 23;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
#Custom Header Image
$args = array(
'width' => 1000,
'flex-width' => true,
'height' => 150,
'flex-height' => true,
'default-image' => get_template_directory_uri() . '/images/default-header.png',
);
add_theme_support( 'custom-header', $args );
#Custom Menus
function register_my_menu() {
register_nav_menu('main-menu',__( 'Main Menu' ));
}
add_action( 'init', 'register_my_menu' );
#Remove "Archive" and "Tag" from category title
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
}
return $title;
});
#Exclude category dairy and dreamlands from search query
function wcs_exclude_category_search( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( $query->is_search ) {
$query->set( 'cat', '-2, -11' );
}
}
add_action( 'pre_get_posts', 'wcs_exclude_category_search', 1 );
# Register sidebars
// Left Sidebar
function sidebar_left() {
register_sidebar(
array (
'name' => __( 'Sidebar left', 'cthulhupark' ),
'id' => 'sidebar-left',
'description' => __( 'Left sidebar', 'cthulhupark' ),
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
}
add_action( 'widgets_init', 'sidebar_left' );
// Right sidebar
function sidebar_right() {
register_sidebar(
array (
'name' => __( 'Sidebar right', 'cthulhupark' ),
'id' => 'sidebar-right',
'description' => __( 'Right sidebar', 'cthulhupark' ),
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
}
add_action( 'widgets_init', 'sidebar_right' );
// Author sidebar
function sidebar_author() {
register_sidebar(
array (
'name' => __( 'Sidebar author', 'cthulhupark' ),
'id' => 'sidebar-author',
'description' => __( 'Author sidebar', 'cthulhupark' ),
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
}
add_action( 'widgets_init', 'sidebar_author' );
#Add post thumbnail support
add_theme_support( 'post-thumbnails' );
include 'widgets/tbe.php';
include 'widgets/frontendLogin.php';
// include 'widgets/latestTBE.php';
?>