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 '
or
tags before and/or after enclosing shortcodes)
* Thanks to Johann Heyne
*/
function blackoot_shortcode_empty_paragraph_fix($content) {
$array = array (
'
[' => '[', ']
' => ']', ']]*>)(.*?)!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('