ID, 'blook_post_sidebar_option', true ) ); if( $blook_post_sidebar == 'global-sidebar' || empty( $blook_post_sidebar ) ){ if( class_exists('WooCommerce') && ( is_cart() || is_checkout() ) ){ $classes[] = 'no-sidebar'; }else{ $classes[] = esc_attr( $global_sidebar_layout ); } }else{ if( class_exists('WooCommerce') && ( is_cart() || is_checkout() ) ){ $classes[] = 'no-sidebar'; }else{ $classes[] = esc_attr( $blook_post_sidebar ); } } }elseif( is_404() ){ $classes[] = 'no-sidebar'; }else{ $classes[] = esc_attr( $global_sidebar_layout ); } } // Adds a class of no-sidebar when there is no sidebar present. if ( ! is_active_sidebar( 'sidebar-1' ) ) { $classes[] = 'no-sidebar'; } $classes[] = esc_attr( blook_get_option("choose_slider_arrow") ); return $classes; } add_filter( 'body_class', 'blook_body_classes' ); /** * Add a pingback url auto-discovery header for single posts, pages, or attachments. */ function blook_pingback_header() { if ( is_singular() && pings_open() ) { printf( '', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'blook_pingback_header' ); /** * Returns Posts Query. * * @since Blook 1.0.0 */ if (!function_exists('blook_get_post_query')): function blook_get_post_query($number_of_post, $post_category = '0', $paged = 1) { $post_args = array( 'post_status' => 'publish', 'post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC', 'ignore_sticky_posts' => true, 'posts_per_page' => absint($number_of_post), ); $post_category = isset($post_category) ? $post_category : '0'; if (absint($post_category) > 0) { $post_args['cat'] = absint($post_category); } $all_posts = new WP_Query($post_args); return $all_posts; } endif; /** * Returns word count of the sentences. * * @since Blook 1.0.0 */ if (!function_exists('blook_get_excerpt')): function blook_get_excerpt($length = 25, $blook_content = null, $post_id = 1) { $length = absint($length); $source_content = preg_replace('`\[[^\]]*\]`', '', $blook_content); $trimmed_content = wp_trim_words($source_content, $length, '...'); return $trimmed_content; } endif; /* Display Breadcrumbs */ if (!function_exists('blook_get_breadcrumb')) : /** * Simple breadcrumb. * * @since 1.0.0 */ function blook_get_breadcrumb() { // Bail if Home Page. if (is_front_page() || is_home()) { return; } $breadcrumb_type = blook_get_option( 'breadcrumb_type' ); if ( 'disabled' === $breadcrumb_type ) { return; } if (!function_exists('breadcrumb_trail')) { /** * Load libraries. */ require_once get_template_directory() . '/assets/resources/breadcrumb-trail/breadcrumb-trail.php'; } $blook_breadcrumb_args = array( 'container' => 'div', 'show_browse' => false, ); ?>