false, 'width' => 1000, 'height' => 364, 'flex-height' => true, ) ); /* Custom background support */ add_theme_support( 'custom-background', array( 'default-color' => '111111', 'default-image' => get_template_directory_uri() . '/img/zwartevilt.png', ) ); } add_action('after_setup_theme', 'blackoot_setup'); /* Adjust $content_width depending on the page being displayed */ function blackoot_content_width() { global $content_width; if ( is_page_template( 'page-full-width.php' ) ) $content_width = 920; } add_action( 'template_redirect', 'blackoot_content_width' ); /* * Page Title */ function blackoot_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'blackoot' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'blackoot_wp_title', 10, 2 ); /* * Add a home link to wp_page_menu() ( wp_nav_menu() fallback ) */ function blackoot_page_menu_args( $args ) { if ( ! isset( $args['show_home'] ) ) $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'blackoot_page_menu_args' ); /* * Add parent Class to parent menu items */ function blackoot_add_menu_parent_class( $items ) { $parents = array(); foreach ( $items as $item ) { if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) { $parents[] = $item->menu_item_parent; } } foreach ( $items as $item ) { if ( in_array( $item->ID, $parents ) ) { $item->classes[] = 'menu-parent-item'; } } return $items; } add_filter( 'wp_nav_menu_objects', 'blackoot_add_menu_parent_class' ); /* * The automatically generated fallback menu is not responsive. * Add an admin notice to warn users who did not set a primary menu * and make this notice dismissable so it is less intrusive. */ function blackoot_admin_notice(){ global $current_user; $user_id = $current_user->ID; /* Display notice if primary menu is not set and user did not dismiss the notice */ if ( !has_nav_menu( 'primary' ) && !get_user_meta($user_id, 'blackoot_ignore_notice' ) ): echo '

Blackoot Lite Notice: you have not set your primary menu yet, and your site is currently using a fallback menu which is not responsive. Please take a minute to set your menu now!'; printf(__('Dismiss'), '?blackoot_notice_ignore=0'); echo '

'; endif; } add_action('admin_notices', 'blackoot_admin_notice'); function blackoot_notice_ignore() { global $current_user; $user_id = $current_user->ID; /* If user clicks to ignore the notice, add that to their user meta */ if ( isset($_GET['blackoot_notice_ignore']) && '0' == $_GET['blackoot_notice_ignore'] ): add_user_meta($user_id, 'blackoot_ignore_notice', true, true); endif; } add_action('admin_init', 'blackoot_notice_ignore'); /* * Register Sidebar and Footer widgetized areas */ function blackoot_widgets_init() { register_sidebar( array( 'name' => __( 'Default Sidebar', 'blackoot' ), 'id' => 'sidebar', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer', 'blackoot' ), 'id' => 'footer-sidebar', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'blackoot_widgets_init' ); /* * Enqueue styles */ function blackoot_styles() { $template_directory_uri = get_template_directory_uri(); // Parent theme URI $stylesheet_directory_uri = get_stylesheet_directory_uri(); // Current theme URI $stylesheet_directory = get_stylesheet_directory(); // Current theme directory $responsive_mode = blackoot_get_option('responsive_mode'); if ($responsive_mode != 'off'): $stylesheet = '/css/blackoot.min.css'; else: $stylesheet = '/css/blackoot-unresponsive.min.css'; endif; /* Child theme support: * Enqueue child-theme's versions of stylesheet in /css if they exist, * or the parent theme's version otherwise */ if ( @file_exists( $stylesheet_directory . $stylesheet ) ) wp_register_style( 'blackoot', $stylesheet_directory_uri . $stylesheet ); else wp_register_style( 'blackoot', $template_directory_uri . $stylesheet ); // Always enqueue style.css from the current theme wp_register_style( 'style', $stylesheet_directory_uri . '/style.css'); wp_enqueue_style( 'blackoot' ); wp_enqueue_style( 'style' ); // Load font-awesome wp_enqueue_style( 'font-awesome', "//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css", array(), null ); // Google Webfonts wp_enqueue_style( 'Quicksand-webfonts', "//fonts.googleapis.com/css?family=Quicksand:400italic,700italic,400,700&subset=latin,latin-ext", array(), null ); } add_action('wp_enqueue_scripts', 'blackoot_styles'); /* * Register editor style */ function blackoot_editor_styles() { add_editor_style(); } add_action( 'init', 'blackoot_editor_styles' ); /* * Enqueue javascripts */ function blackoot_scripts() { wp_enqueue_script('blackoot', get_template_directory_uri() . '/js/blackoot.min.js', array('jquery')); /* Threaded comments support */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } add_action('wp_enqueue_scripts', 'blackoot_scripts'); /* * Remove rel tags in category links (HTML5 invalid) */ function blackoot_remove_rel_cat( $text ) { $text = str_replace(' rel="category"', "", $text); $text = str_replace(' rel="category tag"', "", $text); return $text; } add_filter( 'the_category', 'blackoot_remove_rel_cat' ); /* * Fix for a known issue with enclosing shortcodes and wpautop * (wpautop tends to add empty

or
tags before and/or after enclosing shortcodes) * Thanks to Johann Heyne */ function blackoot_shortcode_empty_paragraph_fix($content) { $array = array ( '

[' => '[', ']

' => ']', ']
' => ']', ); $content = strtr($content, $array); return $content; } add_filter('the_content', 'blackoot_shortcode_empty_paragraph_fix'); /* * Improved version of clean_pre * Based on a work by Emrah Gunduz */ function blackoot_protect_pre($pee) { $pee = preg_replace_callback('!(]*>)(.*?)!is', 'blackoot_eg_clean_pre', $pee ); return $pee; } function blackoot_eg_clean_pre($matches) { if ( is_array($matches) ) $text = $matches[1] . $matches[2] . ""; else $text = $matches; $text = str_replace('
', '', $text); return $text; } add_filter( 'the_content', 'blackoot_protect_pre' ); /* * Customize "read more" links on index view */ function blackoot_excerpt_more( $more ) { global $post; return '... '; } add_filter( 'excerpt_more', 'blackoot_excerpt_more' ); /* * Rewrite and replace wp_trim_excerpt() so it adds a relevant read more link * when the or quicktags are used * This new function preserves every features and filters from the original wp_trim_excerpt */ function blackoot_trim_excerpt($text = '') { global $post; $raw_excerpt = $text; if ( '' == $text ) { $text = get_the_content(''); $text = strip_shortcodes( $text ); $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); $excerpt_length = apply_filters('excerpt_length', 55); $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]'); $text = wp_trim_words( $text, $excerpt_length, $excerpt_more ); /* If the post_content contains a OR a quicktag * AND the more link has not been added already * then we add it now */ if ( ( preg_match('//', $post->post_content ) || preg_match('//', $post->post_content ) ) && strpos($text,$excerpt_more) === false ) { $text .= $excerpt_more; } } return apply_filters('blackoot_trim_excerpt', $text, $raw_excerpt); } remove_filter('get_the_excerpt', 'wp_trim_excerpt'); add_filter( 'get_the_excerpt', 'blackoot_trim_excerpt' ); /* * Create dropdown menu (used in responsive mode) * Requires a custom menu to be set (won't work with fallback menu) */ function blackoot_dropdown_nav_menu() { $menu_name = 'primary'; if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) { if ($menu = wp_get_nav_menu_object( $locations[ $menu_name ] ) ) { $menu_items = wp_get_nav_menu_items($menu->term_id); $menu_list = ''; // $menu_list now ready to output echo $menu_list; } } } /* * Article Nav (Previous/Next post, for use in single.php) */ function blackoot_article_nav(){ if ("" != get_adjacent_post( false, "", false ) || "" != get_adjacent_post( false, "", true ) ): echo '
'; if ("" != get_adjacent_post( false, "", false ) ): // Is there a previous post? echo ''; endif; if ("" != get_adjacent_post( false, "", true ) ): // Is there a next post? echo ''; endif; echo '
'; endif; } /* * Find whether post page needs comments pagination links (used in comments.php) */ function blackoot_page_has_comments_nav() { global $wp_query; return ($wp_query->max_num_comment_pages > 1); } function blackoot_page_has_next_comments_link() { global $wp_query; $max_cpage = $wp_query->max_num_comment_pages; $cpage = get_query_var( 'cpage' ); return ( $max_cpage > $cpage ); } function blackoot_page_has_previous_comments_link() { $cpage = get_query_var( 'cpage' ); return ($cpage > 1); } /* * Find whether attachement page needs navigation links (used in single.php) */ function blackoot_adjacent_image_link($prev = true) { global $post; $post = get_post($post); $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\"")); foreach ( $attachments as $k => $attachment ) if ( $attachment->ID == $post->ID ) break; $k = $prev ? $k - 1 : $k + 1; if ( isset($attachments[$k]) ) return true; else return false; } /* * Generate breadcrumbs */ function blackoot_breadcrumbs() { global $post, $blackoot_options; $sep = $blackoot_options['breadcrumbs_sep']; if (!$sep) $sep = '/'; if (!is_front_page()): echo '', __('Home', 'blackoot'), ' ', $sep, ' '; if (is_home()): $page_for_posts = get_option('page_for_posts'); echo get_the_title($page_for_posts); elseif (is_single()): if ( "icf_portfolio" == get_post_type() ): // Use portfolio page's slug (capitalized) for single portfolio entries echo ucfirst( $blackoot_options['portfolio_entries_slug'] ); else: // Use categories as breadcrumbs for single posts the_category(' '.$sep.' '); endif; echo ' '.$sep.' ', get_the_title(); elseif (is_page()): if($post->post_parent): $anc = get_post_ancestors( $post->ID ); $output = ''; foreach ( $anc as $ancestor ): $output = ''.get_the_title($ancestor).' '.$sep.' ' . $output; endforeach; echo $output; endif; the_title(); elseif (is_category()): single_cat_title(); elseif (is_tag()): single_tag_title(); elseif (is_day()): _e('Daily Archives', 'blackoot'); elseif (is_month()): _e('Monthly Archives', 'blackoot'); elseif (is_year()): _e('Yearly Archives', 'blackoot'); elseif (is_author()): _e('Author Archives', 'blackoot'); elseif (isset($_GET['paged']) && !empty($_GET['paged'])): _e('Blog Archives', 'blackoot'); elseif (is_search()): echo __('Search Results', 'blackoot'); elseif (is_404()): echo __('404 Error', 'blackoot'); endif; endif; } /* * Framework Elements */ include_once('functions/icefit-options/settings.php'); // Admin Settings Panel ?>