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.
*
* It seems it doesn't work though.
*/
#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" );
/**
* Redirects from the gallery to the actual post.
*/
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();
}
}
add_action( 'template_redirect', 'wpsites_attachment_redirect' );
/**
* 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 = ' array('breadcrumb-item'));
//For the current item we need to add a little more info
if(is_array($types) && in_array('current-item', $types))
{
$extra_attribs['class'][] = 'active';
$extra_attribs['aria-current'] = array('page');
}
$atribs_array = array();
preg_match_all('/([a-zA-Z]+)=["\']([a-zA-Z0-9\-\_ ]*)["\']/i', $attribs, $matches);
if(isset($matches[1]))
{
foreach ($matches[1] as $key => $tag)
{
if(isset($matches[2][$key]))
{
$atribs_array[$tag] = explode(' ', $matches[2][$key]);
}
}
}
$merged_attribs = array_merge_recursive($atribs_array , $extra_attribs);
$output = '';
foreach($merged_attribs as $tag => $vals)
{
$output .= sprintf(' %1$s="%2$s"', $tag, implode(' ', $vals));
}
return $output;
}
add_filter('bcn_display_attributes', 'my_display_attributes_filter', 10, 3);
/**
* Reduces padding when breadcrumbs are visible (not on the front page).
*/
function breadcrumbs_dynamic_css() {
?>