From 00c9709fd9763542e848f6278db8ba26af5c9886 Mon Sep 17 00:00:00 2001
From: Max
Date: Mon, 15 Oct 2018 23:46:42 +0200
Subject: Initial commit.
---
functions.php | 243 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 243 insertions(+)
create mode 100644 functions.php
(limited to 'functions.php')
diff --git a/functions.php b/functions.php
new file mode 100644
index 0000000..eb5f9f3
--- /dev/null
+++ b/functions.php
@@ -0,0 +1,243 @@
+posts.post_date_gmt, '$now') > $wait ";
+ }
+ return $where;
+}
+add_filter('posts_where', 'Delay_RSS_After_Publish');
+
+/**
+ * Deaktiviert REST-API und entfernt die Header aus dem HTML.
+ */
+add_filter('rest_enabled', '_return_false');
+add_filter('rest_jsonp_enabled', '_return_false');
+remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
+remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
+
+/**
+ * Entfernt wlwmanifest.xml (Microsoft Live Writer)
+ */
+remove_action('wp_head', 'wlwmanifest_link');
+remove_action('wp_head', 'rsd_link');
+
+/**
+ * Disable W3TC footer comment for everyone but Admins (single site & network mode)
+ */
+if ( !current_user_can( 'activate_plugins' ) ) {
+ add_filter( 'w3tc_can_print_comment', function( $w3tc_setting ) { return false; }, 10, 1 );
+}
+
+/**
+ * Add short code functionality to excerpts.
+ */
+add_filter( 'the_excerpt', 'shortcode_unautop');
+add_filter( 'the_excerpt', 'do_shortcode');
+
+/**
+ * Adds short code: [glossar "Term"]
+ */
+function print_glossar_link( $atts ) {
+ if ( count($atts) == 2 ) {
+ $linktext = $atts[1];
+ } else {
+ $linktext = $atts[0];
+ }
+ return '' . htmlentities($linktext) . '';
+}
+add_shortcode( "glossar", "print_glossar_link" );
+
+/**
+ * Unsure if needed.
+function wpsites_attachment_redirect(){
+ global $post;
+ if ( is_attachment() && isset($post->post_parent) && is_numeric($post->post_parent) && ($post->post_parent != 0) ) {
+
+ wp_redirect( get_permalink( $post->post_parent ), 301 );
+ exit();
+ wp_reset_postdata();
+ }
+}
+*/
+
+/**
+ * Remove tags from tag cloud with zero entries.
+ */
+function set_widget_tag_cloud_excluded_tags($args){
+ $min_count = 1;
+ if ( "brennerei" == $args['taxonomy'] ) {
+ $min_count+=1;
+ }
+ $excluded_tags=get_tags_termid_to_exclude($args['taxonomy'], $min_count);
+ $my_args = array( 'exclude'=>$excluded_tags );
+ $args = wp_parse_args( $args, $my_args );
+ return $args;
+}
+function get_tags_termid_to_exclude($taxonomy, $max_excluded_count_value){
+ $term_ids = array();
+ foreach (
+ get_terms( array(
+ 'taxonomy' => $taxonomy,
+ 'hide_empty' => true) )
+ as $category )
+ {
+ if ($category->count < $max_excluded_count_value ){
+ $term_ids[]=$category->term_id;
+ }
+ }
+ return $term_ids;
+}
+add_filter( 'widget_tag_cloud_args', 'set_widget_tag_cloud_excluded_tags' );
+
+/**
+ * Add Matomo support to tag cloud links.
+ */
+function modify_tag_cloud_add_piwik_class($args) {
+ $start_s = '