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' );
/*
* 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' );
/*
* Register Sidebar and Footer widgetized areas
*/
function blackoot_widgets_init() {
register_sidebar( array(
'name' => __( 'Default Sidebar', 'blackoot-lite' ),
'id' => 'sidebar',
'before_title' => '
';
if ("" != get_adjacent_post( false, "", false ) ): // Is there a previous post?
echo '
',
next_post_link('%link', __('Next Post', 'blackoot-lite') . '' ),
'
';
endif;
if ("" != get_adjacent_post( false, "", true ) ): // Is there a next post?
echo '
',
previous_post_link('%link', '' . __('Previous Post', 'blackoot-lite') ),
'
';
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 '