ID, 'blog-expert-meta-select-layout', true ); if ( empty( $post_options ) || $post_options == 'global' ) { $global_layout = esc_attr( blog_expert_get_option('global_layout') ); } else{ $global_layout = esc_attr($post_options); } } if ($global_layout == 'left-sidebar') { $blog_expert_body_class[]= 'left-sidebar ' . esc_attr( $input ); } elseif ($global_layout == 'no-sidebar') { $blog_expert_body_class[]= 'no-sidebar ' . esc_attr( $input ); } else{ $blog_expert_body_class[]= 'right-sidebar ' . esc_attr( $input ); } return $blog_expert_body_class; } endif; add_action( 'body_class', 'blog_expert_body_class' ); add_action( 'blog_expert_action_sidebar', 'blog_expert_add_sidebar' ); /** * Returns word count of the sentences. * * @since Blog Expert 1.0.0 */ if ( ! function_exists( 'blog_expert_words_count' ) ) : function blog_expert_words_count( $length = 25, $blog_expert_content = null ) { $length = absint( $length ); $source_content = preg_replace( '`\[[^\]]*\]`', '', $blog_expert_content ); $trimmed_content = wp_trim_words( $source_content, $length, '' ); return $trimmed_content; } endif; if ( ! function_exists( 'blog_expert_simple_breadcrumb' ) ) : /** * Simple breadcrumb. * * @since 1.0.0 */ function blog_expert_simple_breadcrumb() { if ( ! function_exists( 'breadcrumb_trail' ) ) { require_once get_template_directory() . '/assets/libraries/breadcrumbs/breadcrumbs.php'; } $breadcrumb_args = array( 'container' => 'div', 'show_browse' => false, ); breadcrumb_trail( $breadcrumb_args ); } endif; if ( ! function_exists( 'blog_expert_custom_posts_navigation' ) ) : /** * Posts navigation. * * @since 1.0.0 */ function blog_expert_custom_posts_navigation() { $pagination_type = blog_expert_get_option( 'pagination_type' ); switch ( $pagination_type ) { case 'default': the_posts_navigation(); break; case 'numeric': the_posts_pagination(); break; default: break; } } endif; add_action( 'blog_expert_action_posts_navigation', 'blog_expert_custom_posts_navigation' ); if( ! function_exists( 'blog_expert_excerpt_length' )) : /** * Excerpt length * * @since Blog Expert 1.0.0 * * @param null * @return int */ function blog_expert_excerpt_length( $length ){ if ( is_admin() ) { return $length; } $excerpt_length = blog_expert_get_option( 'excerpt_length_global' ); if ( absint( $excerpt_length ) > 0 ) { $length = absint( $excerpt_length ); } return $length; } add_filter( 'excerpt_length', 'blog_expert_excerpt_length', 999 ); endif; if ( ! function_exists( 'blog_expert_excerpt_more' ) ) : /** * Implement read more in excerpt. * * @since 1.0.0 * * @param string $more The string shown within the more link. * @return string The excerpt. */ function blog_expert_excerpt_more( $more ) { if ( is_admin() ) { return $more; } $flag_apply_excerpt_read_more = apply_filters( 'blog_expert_filter_excerpt_read_more', true ); if ( true !== $flag_apply_excerpt_read_more ) { return $more; } $output = $more; $read_more_text = esc_html__('Continue Reading','blog-expert'); if ( ! empty( $read_more_text ) ) { $output = ' ' . esc_html( $read_more_text ) . '' . ''; $output = apply_filters( 'blog_expert_filter_read_more_link' , $output ); } return $output; } add_filter('excerpt_more', 'blog_expert_excerpt_more'); endif; if ( ! function_exists( 'blog_expert_get_link_url' ) ) : /** * Return the post URL. * * Falls back to the post permalink if no URL is found in the post. * * @since 1.0.0 * * @return string The Link format URL. */ function blog_expert_get_link_url() { $content = get_the_content(); $has_url = get_url_in_content( $content ); return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); } endif; if( class_exists( 'Booster_Extension_Class' ) ){ add_filter('booster_extemsion_content_after_filter','blog_expert_after_content_pagination'); } if( !function_exists('blog_expert_after_content_pagination') ): function blog_expert_after_content_pagination($after_content){ $pagination_single = wp_link_pages( array( 'before' => '', 'echo' => false ) ); $after_content = $pagination_single.$after_content; return $after_content; } endif; if( !function_exists('blog_expert_post_floating_nav') ): function blog_expert_post_floating_nav(){ $default = blog_expert_get_default_theme_options(); $ed_floating_next_previous_nav = get_theme_mod( 'ed_floating_next_previous_nav',$default['ed_floating_next_previous_nav'] ); if( 'post' === get_post_type() && $ed_floating_next_previous_nav ){ $next_post = get_next_post(); $prev_post = get_previous_post(); if( isset( $prev_post->ID ) ){ $prev_link = get_permalink( $prev_post->ID );?>
ID,'medium' ) ){ ?> ID,'medium' ) ); ?> ID ) ); ?>
ID ) ){ $next_link = get_permalink( $next_post->ID );?>
ID,'medium' ) ){ ?> ID,'medium' ) ); ?> ID ) ); ?>
array( 'width'=>array(), 'height'=>array(), 'src'=>array(), 'frameborder'=>array(), 'allow'=>array(), 'allowfullscreen'=>array(), ) ); return wp_kses($input,$all_tags); } endif; /** * Print the first instance of a block in the content, and then break away. * * @since Blog Expert 1.2.4 * * @param string $block_name The full block type name, or a partial match. * Example: `core/image`, `core-embed/*`. * @param string|null $content The content to search in. Use null for get_the_content(). * @param int $instances How many instances of the block will be printed (max). Default 1. * @return bool Returns true if a block was located & printed, otherwise false. */ function blog_expert_print_first_instance_of_block( $block_name, $content = null, $instances = 1 ) { $instances_count = 0; $blocks_content = ''; if ( ! $content ) { $content = get_the_content(); } // Parse blocks in the content. $blocks = parse_blocks( $content ); // Loop blocks. foreach ( $blocks as $block ) { // Sanity check. if ( ! isset( $block['blockName'] ) ) { continue; } // Check if this the block matches the $block_name. $is_matching_block = false; // If the block ends with *, try to match the first portion. if ( '*' === $block_name[-1] ) { $is_matching_block = 0 === strpos( $block['blockName'], rtrim( $block_name, '*' ) ); } else { $is_matching_block = $block_name === $block['blockName']; } if ( $is_matching_block ) { // Increment count. $instances_count++; // Add the block HTML. $blocks_content .= render_block( $block ); // Break the loop if the $instances count was reached. if ( $instances_count >= $instances ) { break; } } } if ( $blocks_content ) { /** This filter is documented in wp-includes/post-template.php */ echo apply_filters( 'the_content', $blocks_content ); // phpcs:ignore WordPress.Security.EscapeOutput return true; } return false; }