-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
206 lines (174 loc) · 7.88 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
// include parent stylesheet
add_action('wp_enqueue_scripts', 'theme_enqueue_styles');
function theme_enqueue_styles()
{
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
wp_enqueue_style('subchild-style', get_stylesheet_directory_uri() . '/css/twentytwelve-dark.css');
wp_enqueue_style('main-style', get_stylesheet_directory_uri() . '/css/gruseltour.css');
wp_enqueue_style('base-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style', 'subchild-style', 'main-style'));
}
// Use WP-PageNavi when it's active
if (!function_exists('twentytwelve_content_nav')) {
function twentytwelve_content_nav($nav_id)
{
global $wp_query;
if ($wp_query->max_num_pages > 1): ?>
<?php /* add wp-pagenavi support for posts */?>
<?php if (function_exists('wp_pagenavi')): ?>
<?php wp_pagenavi();?>
<?php else: ?>
<nav id="<?php echo $nav_id; ?>">
<h3 class="assistive-text"><?php _e('Post navigation', 'tto');?></h3>
<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">←</span> Older posts', 'tto'));?></div>
<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">←</span>', 'tto'));?></div>
</nav><!-- #nav-above -->
<?php endif;?>
<?php endif;
}
}
// OpenGraph Images für Startseite
add_action('wp_head', 'add_ogimages_for_frontpage');
function add_ogimages_for_frontpage()
{
if (!is_front_page()) {
return;
}
$output = '<meta property="og:image" content="https://gruseltour-leipzig.de/wordpress/wp-content/uploads/2013/05/button-scary.png" /><meta property="og:image" content="https://gruseltour-leipzig.de/wordpress/wp-content/uploads/2014/05/cropped-grusel-poster-a3.jpg" /><meta property="og:image" content="https://gruseltour-leipzig.de/wordpress/wp-content/uploads/2014/06/1.jpg" />';
echo $output;
}
/**
* Datepicker initialisieren
*/
add_action('wp_enqueue_scripts', 'load_datepicker_scripts');
function load_datepicker_scripts()
{
// Let's enqueue a script only to be used on a specific page of the site
if (!is_page('anmeldung')) {
return;
}
// Use `get_stylesheet_directoy_uri() if your script is inside your theme or child theme.
wp_register_script('dateutil-script', get_stylesheet_directory_uri() . '/js/dateutil.js');
wp_register_script('datepicker-script', get_stylesheet_directory_uri() . '/js/datepicker.js');
// Enqueue a script that has both jQuery (automatically registered by WordPress)
// and my-script (registered earlier) as dependencies.
wp_enqueue_script('style-datepicker-script', get_stylesheet_directory_uri() . '/js/style-datepicker.js', array('jquery', 'jquery-ui', 'dateutil-script', 'datepicker-script'), false, true);
}
/**
* Formularanzeige ändern
*/
add_action('wp_enqueue_scripts', 'hide_form_values_scripts');
function hide_form_values_scripts()
{
// Let's enqueue a script only to be used on a specific page of the site
if (is_page('anmeldung') || is_page('wir-erwarten-euch-an-halloween-2015') || is_page('wave-gotik-treffen-2015-wgt') || is_page('geschenkgutschein') || is_page('wgt-2016') || is_page('friedhofstour') || is_page('wgt-2017') || is_page('halloween-2017') || is_page('halloween-2018') || is_page('walpurgisnacht-2018') || is_page('walpurgisnacht-2019') || is_page('wgt-2019') || is_page('halloween-2019')) {
// Enqueue a script that has both jQuery (automatically registered by WordPress)
wp_enqueue_script('hide-form-values-script', get_stylesheet_directory_uri() . '/js/hide-form-values.js', array('jquery'), false, true);
}
}
// Jquery UI
add_action('wp_enqueue_scripts', 'load_jquery_ui');
function load_jquery_ui()
{
// Let's enqueue a script only to be used on a specific page of the site
if (!is_page('anmeldung')) {
return;
}
wp_enqueue_style('jquery-style', 'https://ajax.aspnetcdn.com/ajax/jquery.ui/1.12.1/themes/smoothness/jquery-ui.css', false, '1.12.1');
}
add_action('wp_enqueue_scripts', 'update_jquery_ui');
function update_jquery_ui(){
wp_deregister_script('jquery-ui');
if (!is_page('anmeldung')) {
return;
}
wp_register_script('jquery-ui', "https://ajax.aspnetcdn.com/ajax/jquery.ui/1.12.1/jquery-ui.min.js", ['jquery'], '1.12.1', true);
wp_enqueue_script('jquery-ui');
}
function is_blog() {
return ( is_archive() || is_author() || is_category() || is_home() || is_single() || is_tag()) && 'post' == get_post_type();
}
/**
* Font Awesome hinzufügen (Icons)
*/
add_action('wp_enqueue_scripts', 'load_font_awesome');
function load_font_awesome()
{
if (!is_blog()) {
return;
}
//wp_enqueue_script('font-awesome', '//use.fontawesome.com/b3e50273fc.js', false, false, true);
wp_enqueue_script('font-awesome', 'https://use.fontawesome.com/30e90113a0.js', false, '4.7.0', true);
}
// Exclude Posts with following id
add_filter('bwp_gxs_excluded_posts', 'bwp_gxs_exclude_posts', 10, 2);
function bwp_gxs_exclude_posts($excluded_posts, $post_type)
{
// old halloween, wgt and information page
return array(12, 157, 1356, 1846);
}
// Change form confirmation message
add_filter('grunion_contact_form_success_message', 'change_grunion_success_message');
function change_grunion_success_message($msg)
{
return '<h3>' . 'Vielen Dank für deine Anfrage. Wir beantworten sie innerhalb weniger Stunden.<br />Solltest du dennoch nach einem Tag keine Antwort von uns erhalten, schau bitte in deinem Spam-Ordner nach. Besonders bei Web.de, Yahoo und GMX-Mailadressen landen wir leider häufig im Spam-Ordner. ' . '</h3>';
}
add_action('wp_enqueue_scripts', 'update_jquery');
function update_jquery(){
wp_deregister_script('jquery');
wp_register_script('jquery', ("https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.5.1.min.js"), false, '3.5.1', true);
wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'update_jquery_migrate');
function update_jquery_migrate(){
wp_deregister_script('jquery-migrate');
wp_register_script('jquery-migrate', ("https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.3.1/jquery-migrate.min.js"), ['jquery'], '3.3.1', true);
wp_enqueue_script('jquery-migrate');
}
add_filter('autoptimize_filter_extra_gfont_fontstring','add_display');
function add_display($in) {
return $in.'&display=auto';
}
add_action('wp_enqueue_scripts', 'remove_cloudinary_videoplayer');
function remove_cloudinary_videoplayer() {
wp_deregister_style('cld-player');
wp_dequeue_style('cld-player');
wp_deregister_script('cld-video-init');
wp_dequeue_script('cld-video-init');
wp_deregister_script('cld-player');
wp_dequeue_script('cld-player');
}
add_action('wp_head', 'remove_cloudinary_gallery');
add_action('wp_enqueue_scripts', 'remove_cloudinary_gallery');
function remove_cloudinary_gallery() {
wp_deregister_style('cloudinary-gallery-block-css');
wp_dequeue_style('cloudinary-gallery-block-css');
wp_deregister_script('cloudinary-gallery-block-js');
wp_deregister_script('cloudinary-gallery-init');
wp_deregister_script('cld-gallery');
wp_deregister_script('cld-gallery-js');
wp_dequeue_script('cloudinary-gallery-block-js');
wp_dequeue_script('cloudinary-gallery-init');
wp_dequeue_script('cld-gallery');
wp_dequeue_script('cld-gallery-js');
}
function test_print_scripts_styles() {
$result = [];
$result['scripts'] = [];
$result['styles'] = [];
// Print all loaded Scripts
global $wp_scripts;
foreach( $wp_scripts->queue as $script ) :
$result['scripts'][] = $wp_scripts->registered[$script]->src . ";";
endforeach;
// Print all loaded Styles (CSS)
global $wp_styles;
foreach( $wp_styles->queue as $style ) :
$result['styles'][] = $wp_styles->registered[$style]->src . ";";
endforeach;
return $result;
}
//add_action( 'wp_head', 'gt_process_list');
function gt_process_list() {
print_r( test_print_scripts_styles() );
}