implode('&family=', $font_families), 'display' => 'swap', ), 'https://fonts.googleapis.com/css2'); return esc_url_raw($fonts_url); } endif; if (!function_exists('blogcorner_get_option')) : /** * Get customizer value by key. * * @param string $key Option key. * @return mixed Option value. * @since 1.0.0 * */ function blogcorner_get_option($key) { $key_value = ''; if (!$key) { return $key_value; } $default_values = blogcorner_get_default_customizer_values(); $customizer_values = get_theme_mod('blogcorner_options'); $customizer_values = wp_parse_args($customizer_values, $default_values); $key_value = (isset($customizer_values[$key])) ? $customizer_values[$key] : ''; return $key_value; } endif; /** * Blogcorner SVG Icon helper functions * * @package Blogcorner * @since 1.0.0 */ if (!function_exists('blogcorner_theme_svg')): /** * Output and Get Theme SVG. * Output and get the SVG markup for an icon in the Blogcorner_SVG_Icons class. * * @param string $svg_name The name of the icon. * @param string $group The group the icon belongs to. * @param string $color Color code. */ function blogcorner_theme_svg($svg_name, $return = false) { if ($return) { return blogcorner_get_theme_svg($svg_name); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in blogcorner_get_theme_svg();. } else { echo blogcorner_get_theme_svg($svg_name); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in blogcorner_get_theme_svg();. } } endif; if (!function_exists('blogcorner_get_theme_svg')): /** * Get information about the SVG icon. * * @param string $svg_name The name of the icon. * @param string $group The group the icon belongs to. * @param string $color Color code. */ function blogcorner_get_theme_svg($svg_name) { // Make sure that only our allowed tags and attributes are included. $svg = wp_kses( Blogcorner_SVG_Icons::get_svg($svg_name), array( 'svg' => array( 'class' => true, 'xmlns' => true, 'width' => true, 'height' => true, 'viewbox' => true, 'aria-hidden' => true, 'role' => true, 'focusable' => true, ), 'path' => array( 'fill' => true, 'fill-rule' => true, 'd' => true, 'transform' => true, ), 'polygon' => array( 'fill' => true, 'fill-rule' => true, 'points' => true, 'transform' => true, 'focusable' => true, ), 'line' => array( 'stroke' => true, 'x1' => true, 'x2' => true, 'y1' => true, 'y2' => true, ), ) ); if (!$svg) { return false; } return $svg; } endif; if (!function_exists('blogcorner_svg_escape')): /** * Get information about the SVG icon. * * @param string $svg_name The name of the icon. * @param string $group The group the icon belongs to. * @param string $color Color code. */ function blogcorner_svg_escape($input) { // Make sure that only our allowed tags and attributes are included. $svg = wp_kses( $input, array( 'svg' => array( 'class' => true, 'xmlns' => true, 'width' => true, 'height' => true, 'viewbox' => true, 'aria-hidden' => true, 'role' => true, 'focusable' => true, ), 'path' => array( 'fill' => true, 'fill-rule' => true, 'd' => true, 'transform' => true, ), 'polygon' => array( 'fill' => true, 'fill-rule' => true, 'points' => true, 'transform' => true, 'focusable' => true, ), ) ); if (!$svg) { return false; } return $svg; } endif; if (!function_exists('blogcorner_social_menu_icon')) : function blogcorner_social_menu_icon($item_output, $item, $depth, $args) { // Add Icon if (isset($args->theme_location) && 'social-menu' === $args->theme_location) { $svg = Blogcorner_SVG_Icons::get_theme_svg_name($item->url); if (empty($svg)) { $svg = blogcorner_theme_svg('link', $return = true); } $item_output = str_replace($args->link_after, '' . $svg, $item_output); } return $item_output; } endif; add_filter('walker_nav_menu_start_el', 'blogcorner_social_menu_icon', 10, 4); if (!function_exists('blogcorner_comment_form_custom_fields')) : /** * Custom comment form fields. * * @param array $fields * * @return array */ function blogcorner_comment_form_custom_fields($fields) { $commenter = wp_get_current_commenter(); $req = get_option('require_name_email'); $aria_req = ($req ? ' aria-required="true"' : ''); if (is_user_logged_in()) { $fields = array_merge($fields, array( 'author' => '

', 'email' => '

', )); } else { $fields = array_merge($fields, array( 'author' => '

', )); } return $fields; } endif; add_filter('comment_form_default_fields', 'blogcorner_comment_form_custom_fields'); if( !function_exists( 'blogcorner_post_category_list' ) ) : // Post Category List. function blogcorner_post_category_list( $select_cat = true ){ $post_cat_lists = get_categories( array( 'hide_empty' => '0', 'exclude' => '1', ) ); $post_cat_cat_array = array(); if( $select_cat ){ $post_cat_cat_array[''] = esc_html__( '-- Select Category --','blogcorner' ); } foreach ( $post_cat_lists as $post_cat_list ) { $post_cat_cat_array[$post_cat_list->slug] = $post_cat_list->name; } return $post_cat_cat_array; } endif; if( !function_exists( 'blogcorner_woocommerce_product_cat' ) ) : // Post Category List. function blogcorner_woocommerce_product_cat(){ $post_cat_lists = get_categories( array( 'taxonomy' => 'product_cat', 'orderby' => 'name', 'show_count' => 0, 'pad_counts' => 0, 'hide_empty' => '0', 'exclude' => '1', ) ); $post_cat_cat_array = array(); $post_cat_cat_array[''] = esc_html__( '--Select Category--','blogcorner' ); foreach ( $post_cat_lists as $post_cat_list ) { $post_cat_cat_array[$post_cat_list->slug] = $post_cat_list->name; } return $post_cat_cat_array; } endif; if (!function_exists('blogcorner_get_page_layout')) : /** * Get Page Layout based on the post meta or customizer value * * @return string Page Layout. * @since 1.0.0 * */ function blogcorner_get_page_layout() { global $post; $page_layout = ''; if( is_singular( 'post' ) ){ $blogcorner_post_sidebar = esc_attr( get_post_meta( $post->ID, 'blogcorner_post_sidebar_option', true ) ); if( $blogcorner_post_sidebar == 'global-sidebar' || empty( $blogcorner_post_sidebar ) ){ $page_layout = blogcorner_get_option('single_sidebar_layout'); }else{ $page_layout = $blogcorner_post_sidebar; } } return $page_layout; } endif; if ( ! function_exists( 'blogcorner_get_footer_layouts' ) ) : /** * Returns footer layout options. * * @since 1.0.0 * * @return array Options array. */ function blogcorner_get_footer_layouts() { $options = apply_filters( 'blogcorner_footer_layouts', array( 'footer_layout_1' => array( 'url' => get_template_directory_uri().'/assets/images/widget-column-4.png', 'label' => esc_html__( 'Four Columns', 'blogcorner' ), ), 'footer_layout_2' => array( 'url' => get_template_directory_uri().'/assets/images/widget-column-3.png', 'label' => esc_html__( 'Three Columns', 'blogcorner' ), ), 'footer_layout_3' => array( 'url' => get_template_directory_uri().'/assets/images/widget-column-2.png', 'label' => esc_html__( 'Two Columns', 'blogcorner' ), ), 'footer_layout_4' => array( 'url' => get_template_directory_uri().'/assets/images/widget-column-2.png', 'label' => esc_html__( 'Four Columns', 'blogcorner' ), ), 'footer_layout_5' => array( 'url' => get_template_directory_uri().'/assets/images/widget-column-2.png', 'label' => esc_html__( 'five Columns', 'blogcorner' ), ), 'footer_layout_6' => array( 'url' => get_template_directory_uri().'/assets/images/widget-column-2.png', 'label' => esc_html__( 'six Columns', 'blogcorner' ), ), ) ); return $options; } endif; if (!function_exists('blogcorner_print_first_instance_of_block')): /** Print the first instance of a block in the content, and then break away. * @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 blogcorner_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; } endif; function blogcorner_gravatar_alt($blogcorner_gravatar) { if (have_comments()) { $alt = get_comment_author(); } else { $alt = get_the_author_meta('display_name'); } $blogcorner_gravatar = str_replace('alt=\'\'', 'alt=\'Avatar for ' . $alt . '\'', $blogcorner_gravatar); return $blogcorner_gravatar; } add_filter('get_avatar', 'blogcorner_gravatar_alt'); if( ! function_exists( 'blogcorner_iframe_escape' ) ): /** Escape Iframe **/ function blogcorner_iframe_escape( $input ){ $all_tags = array( 'iframe'=>array( 'width'=>array(), 'height'=>array(), 'src'=>array(), 'frameborder'=>array(), 'allow'=>array(), 'allowfullscreen'=>array(), ), 'video'=>array( 'width'=>array(), 'height'=>array(), 'src'=>array(), 'style'=>array(), 'controls'=>array(), ) ); return wp_kses($input,$all_tags); } endif; if ( ! function_exists( 'blogcorner_social_share' ) ): /** * Social Share **/ function blogcorner_social_share() { $enable_facebook = blogcorner_get_option( 'enable_facebook'); $enable_twitter = blogcorner_get_option( 'enable_twitter' ); $enable_pinterest = blogcorner_get_option( 'enable_pinterest'); $enable_linkedin = blogcorner_get_option( 'enable_linkedin'); $enable_telegram = blogcorner_get_option('enable_telegram'); $enable_stumbleupon = blogcorner_get_option('enable_stumbleupon'); $enable_email = blogcorner_get_option( 'enable_email'); if( $enable_facebook || $enable_twitter || $enable_pinterest || $enable_linkedin || $enable_email || $enable_telegram || $enable_stumbleupon) { $permalink = urlencode( get_the_permalink() ); $post_title = html_entity_decode( get_the_title(), ENT_COMPAT, 'UTF-8' ); $media_url = urlencode( get_the_post_thumbnail_url( get_the_ID(), 'full' ) ); ?>
" target="_blank" class="twp-social-share-icon twp-share-icon-email">
'post', 'posts_per_page' => 4, 'post__not_in' => get_option("sticky_posts"))); $site_fallback_image = blogcorner_get_option('site_fallback_image'); if ($lead_post_query->have_posts()): ?>
have_posts()) { $lead_post_query->the_post(); ?>
(.*?)<\/div>/is'; // Remove the content inside wp-block-embed divs from the content $content = preg_replace($pattern, '
', $content); return $content; } if( !function_exists('blogcorner_post_floating_nav') ): function blogcorner_post_floating_nav(){ $show_fixed_next_previous_post_navigation = blogcorner_get_option('show_fixed_next_previous_post_navigation'); if( 'post' === get_post_type() && $show_fixed_next_previous_post_navigation ){ $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_large' ) ); ?> ID ) ); ?>
ID ) ){ $next_link = get_permalink( $next_post->ID );?>
ID,'medium' ) ){ ?> ID,'medium_large' ) ); ?> ID ) ); ?>
array( 'url' => get_template_directory_uri() . '/assets/images/left_sidebar.png', 'label' => esc_html__('Left Sidebar', 'blogcorner'), ), 'right-sidebar' => array( 'url' => get_template_directory_uri() . '/assets/images/right_sidebar.png', 'label' => esc_html__('Right Sidebar', 'blogcorner'), ), 'no-sidebar' => array( 'url' => get_template_directory_uri() . '/assets/images/no_sidebar.png', 'label' => esc_html__('No Sidebar', 'blogcorner'), ), )); return $options; } endif;