* @copyright 2016 Uitz-Mehler EDV-Dienstleistungen http://edv.uitz.net * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 or later * @version 1.2 */ if ( ! isset( $content_width ) ) { $content_width = 945; } if ( ! function_exists( 'bootflex_setup' ) ) : function bootflex_setup() { add_theme_support( 'menus' ); add_theme_support( 'automatic-feed-links'); $args = array( 'flex-height' => true, 'flex-width' => true, 'height' => 0, 'width' => 0, 'default-image' => get_template_directory_uri() . '/images/bg.png', 'uploads' => true, 'header-text' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', 'random-default' => false, 'default-text-color' => '#fff' ); add_theme_support( 'custom-header', $args ); add_theme_support( 'title-tag'); add_theme_support( 'default-image'); add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'widgets' ) ); register_default_headers( array( 'grid' => array( 'url' => get_template_directory_uri() . '/images/bg.png', 'thumbnail_url' => get_template_directory_uri() . '/images/bg.png', 'description' => _x( 'Grid', 'header image description', 'bootflex' ) ), )); add_filter( 'use_default_gallery_style', '__return_false' ); function bootflex_enqueue_comment_reply() { if ( get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'comment_form_before', 'bootflex_enqueue_comment_reply' ); function bootflex_add_editor_styles() { add_editor_style(); } add_action( 'admin_init', 'bootflex_add_editor_styles' ); add_action( 'widgets_init', 'theme_bootflex_widgets_init' ); function theme_bootflex_widgets_init() { register_sidebar(array( 'name' => __( 'Blogpage', 'bootflex' ), 'before_widget' => '', 'before_title' => '
a little. Full reference of things you can show/remove is here: http://rjpargeter.com/2009/09/removing-wordpress-wp_head-elements/ remove_action('wp_head', 'wp_generator');// Removes the WordPress version as a layer of simple security // Bootstrap Menu Support require_once('inc/wp_bootstrap_navwalker.php'); function register_my_menu() { register_nav_menu('header-menu',__( 'Header Menu', 'bootflex' )); } add_action( 'init', 'register_my_menu' ); // Language Support add_action('after_setup_theme', 'my_theme_setup'); function my_theme_setup(){ load_theme_textdomain('bootflex', get_template_directory() . '/lang'); } require get_template_directory() . '/inc/customizer.php'; add_filter( 'the_content_more_link', 'modify_read_more_link' ); function modify_read_more_link() { return ' …' . __('Read more', 'bootflex') . ' '; } add_filter('get_avatar','add_gravatar_class'); function add_gravatar_class($class) { $class = str_replace("class='avatar", "class='avatar img-rounded", $class); return $class; } //function qot_add_editor_styles() { //add_editor_style( 'custom-editor-style.css' ); //} //add_action( 'admin_init', 'qot_add_editor_styles' ); /** * Breadcrumbs * * Prints full Bootstrap compatible HTML for breadcrumbs * */ function bootflex_breadcrumbs() { global $post; echo ''; } /** * Adds pagecount to breadcrumbs if needed * * @return string */ function bootflex_breadcrumbs_paged(){ $bootflex_myreturn = ''; if ( get_query_var('paged') ) { if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) $bootflex_myreturn .= ' ('; $bootflex_myreturn .= __('Page','bootflex') . ' ' . get_query_var('paged'); if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) $bootflex_myreturn .= ')'; } return $bootflex_myreturn; } /** * Adds Glyphs to known Widgets * * @param strin $title * @return string */ function widget_title_glyph( $title ) { if(!$title){ return '';} if( $title == "Categories" OR $title == "Kategorien") { return ' ' . $title; } elseif( $title == "Archive" OR $title == "Archives" ) { return ' ' . $title; } elseif( $title == "Letzte Beiträge" OR $title == "Recent Posts" ) { return ' ' . $title; } elseif( $title == "Letzte Kommentare" OR $title == "Recent Comments" ) { return ' ' . $title; } elseif( $title == "Schlagwörter" OR $title == "Tags" ) { return ' ' . $title; } elseif( $title == "Seiten" OR $title == "Pages" ) { return ' ' . $title; } elseif( $title == "Kalender" OR $title == "Calendar") { return ' ' . $title; } elseif( $title == "Meta") { return ' ' . $title; } elseif( strpos($title,'.com') OR strpos($title,'RSS') OR strpos($title,'.net') OR strpos($title,'.org') OR strpos($title,'.at') OR strpos($title,'.de')) { return ' ' . $title; } elseif( strpos($title,'Facebook')) { return ' ' . $title; } else { return ' ' . $title; } } add_filter( 'widget_title', 'widget_title_glyph' ); /** * Get first post with thumbs for frontpage * * @return Object Object with only one post */ function bootflex_get_first(){ $args = array( 'posts_per_page' => 1, 'offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => get_option( 'sticky_posts' ), 'meta_query' => array(array( 'key' => '_thumbnail_id', 'value' => '', 'compare' => '!=', )) ); $firstpost = new WP_Query( $args ); $posttemp = new stdClass(); $posttemp->post_id = $firstpost->post->ID; $posttemp->post_date = $firstpost->post->post_date; $posttemp->title = $firstpost->post->post_title; $thumb_id = (int)get_post_thumbnail_id($firstpost->post->ID); $posttemp->image = wp_get_attachment_image_src( $thumb_id, 'bootflex-image'); $posttemp->imagesrc = wp_get_attachment_image_srcset( $thumb_id, 'bootflex-image' ); $posttemp->content = wp_trim_words( $firstpost->post->post_content,18, ' …' . __('Read more', 'bootflex') . ' ' ); $posttemp->link = get_permalink($firstpost->post->ID); return $posttemp; } function is_login_page() { return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php')); } //load jquery in the footer function jquery_in_footer() { if (!is_admin() AND ! is_login_page()) { wp_deregister_script('jquery'); // load the local copy of jQuery in the footer wp_register_script('jquery', home_url(trailingslashit(WPINC) . 'js/jquery/jquery.js'), array(), null, true); wp_enqueue_script('jquery'); } } add_action('init', 'jquery_in_footer'); // load scripts if ( ! function_exists( 'bootflex_scripts' ) ): function bootflex_scripts() { $bootflex_subtheme = get_option( 'bootflex_subtheme_select' ); if(!$bootflex_subtheme){ $bootflex_subtheme = get_template_directory_uri() . '/assets/css/bootstrap.min.css'; } if( get_option( 'bootflex_font_awesome_cdn_select' )){ $bootflex_font_awesome = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css'; } else { $bootflex_font_awesome = get_template_directory_uri() . '/assets/css/font-awesome.min.css'; } wp_enqueue_style( 'bootflex', get_stylesheet_uri() , array('bootstrap') ); wp_enqueue_style( 'bootstrap', $bootflex_subtheme ); wp_enqueue_style( 'fontawesome', $bootflex_font_awesome ); wp_enqueue_script( 'jquery', '', array( ) , FALSE , TRUE); wp_enqueue_script( 'bootstrapjs', get_template_directory_uri() . '/assets/scripts/bootstrap.min.js', array( 'jquery' ) , FALSE , TRUE); wp_enqueue_script( 'generaljs', get_template_directory_uri() . '/assets/scripts/general.js', array( 'bootstrapjs' ) , FALSE , TRUE); } endif; add_action( 'wp_enqueue_scripts', 'bootflex_scripts' ); //woocommerce compatibel add_filter('loop_shop_per_page', create_function('$productCount', 'return 8;'), 20 ); /** * filter function to force wordpress to add our custom srcset values * @param array $sources { * One or more arrays of source data to include in the 'srcset'. * * @type type array $width { * @type type string $url The URL of an image source. * @type type string $descriptor The descriptor type used in the image candidate string, * either 'w' or 'x'. * @type type int $value The source width, if paired with a 'w' descriptor or a * pixel density value if paired with an 'x' descriptor. * } * } * @param array $size_array Array of width and height values in pixels (in that order). * @param string $image_src The 'src' of the image. * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'. * @param int $attachment_id Image attachment ID. * @author: Aakash Dodiya * @website: http://www.developersq.com */ //add_filter( 'wp_calculate_image_srcset', 'bootflex_add_custom_image_srcset', 10, 5 ); //add_filter( 'wp_calculate_image_srcset', 'bootflex_add_custom_image_srcset2', 10, 5 ); //function bootflex_add_custom_image_srcset( $sources, $size_array, $image_src, $image_meta, $attachment_id ){ // // $image_basename = wp_basename( $image_meta['file'] ); // $image_baseurl = _wp_upload_dir_baseurl(); // // Uploads are (or have been) in year/month sub-directories. // if ( $image_basename !== $image_meta['file'] ) { // $dirname = dirname( $image_meta['file'] ); // // if ( $dirname !== '.' ) { // $image_baseurl = trailingslashit( $image_baseurl ) . $dirname; // } // } // // get image baseurl // $image_baseurl = trailingslashit( $image_baseurl ); // // check whether our custom image size exists in image meta // if( array_key_exists('bootflex-image-resp1', $image_meta['sizes'] ) ){ // // add source value to create srcset // $sources[ $image_meta['sizes']['bootflex-image-resp1']['width'] ] = array( // 'url' => $image_baseurl . $image_meta['sizes']['bootflex-image-resp1']['file'], // 'descriptor' => 'w', // 'value' => $image_meta['sizes']['bootflex-image-resp1']['width'], // ); // } // //return sources with new srcset value // return $sources; //} //function bootflex_add_custom_image_srcset2( $sources, $size_array, $image_src, $image_meta, $attachment_id ){ // // $image_basename = wp_basename( $image_meta['file'] ); // $image_baseurl = _wp_upload_dir_baseurl(); // // Uploads are (or have been) in year/month sub-directories. // if ( $image_basename !== $image_meta['file'] ) { // $dirname = dirname( $image_meta['file'] ); // // if ( $dirname !== '.' ) { // $image_baseurl = trailingslashit( $image_baseurl ) . $dirname; // } // } // // get image baseurl // $image_baseurl = trailingslashit( $image_baseurl ); // // check whether our custom image size exists in image meta // if( array_key_exists('bootflex-image-list', $image_meta['sizes'] ) ){ // // add source value to create srcset // $sources[ $image_meta['sizes']['bootflex-image-list']['width'] ] = array( // 'url' => $image_baseurl . $image_meta['sizes']['bootflex-image-list']['file'], // 'descriptor' => 'w', // 'value' => $image_meta['sizes']['bootflex-image-list']['width'], // ); // } // //return sources with new srcset value // return $sources; //} /** * Disable the emoji's */ function disable_emojis() { remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); remove_action( 'wp_print_styles', 'print_emoji_styles' ); remove_action( 'admin_print_styles', 'print_emoji_styles' ); remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' ); } add_action( 'init', 'disable_emojis' ); /** * Remove W3 Total Cache Footer except for admins */ if ( !current_user_can( 'activate_plugins' ) ) { add_filter( 'w3tc_can_print_comment', function( $w3tc_setting ) { return false; }, 10, 1 ); } function get_attachment_id_from_src ($image_src) { global $wpdb; $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'"; $id = $wpdb->get_var($query); return $id; } ?>
comment_approved == '0' ) : ?>