', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'bloghub_pingback_header' ); /** * Allow Html */ if ( !function_exists( 'bloghub_allow_html' ) ) { function bloghub_allow_html(){ return array( 'a' => array( 'href' => array(), 'target' => array(), 'title' => array(), 'rel' => array(), ), 'strong' => array(), 'small' => array(), 'span' => array( 'style' => array(), ), 'p' => array(), 'br' => array(), 'img' => array( 'src' => array(), 'title' => array(), 'alt' => array(), 'width' => array(), 'height' => array(), 'class' => array(), ), 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), ); } } /** * Add span tag in archive list count number */ function bloghub_add_span_archive_count($links) { $links = str_replace(' (', ' (', $links); $links = str_replace(')', ')', $links); return $links; } add_filter('get_archives_link', 'bloghub_add_span_archive_count'); /** * Add span tag in category list count number */ function bloghub_add_span_category_count($links) { $links = str_replace(' (', ' (', $links); $links = str_replace(')', ')', $links); return $links; } add_filter('wp_list_categories', 'bloghub_add_span_category_count'); /** * Prints HTML with meta information for the current post-date/time. */ if ( ! function_exists( 'bloghub_posted_on' ) ) : function bloghub_posted_on() { $time_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( DATE_W3C ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( DATE_W3C ) ), esc_html( get_the_modified_date() ) ); $posted_on = sprintf( /* translators: %s: post date. */ esc_html_x( ' %s', 'post date', 'bloghub' ), // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings '' . $time_string . '' ); echo '' . $posted_on . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } endif; /** * Prints HTML with meta information for the current author. */ if ( ! function_exists( 'bloghub_posted_by' ) ) : function bloghub_posted_by() { $byline = sprintf( /* translators: %s: post author. */ esc_html_x( ' %s', 'post author', 'bloghub' ), // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings '' . esc_html( get_the_author() ) . '' ); echo ' ' . $byline . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } endif; /** * Prints HTML with meta information for the tags. */ if ( ! function_exists( 'bloghub_post_tags' ) ) : function bloghub_post_tags() { // Hide category and tag text for pages. if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list('', esc_html_x('', 'list item separator', 'bloghub')); // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings if ($tags_list) { /* translators: 1: list of tags. */ printf('' .esc_html__('Tags:','bloghub').'' .esc_html__(' %1$s', 'bloghub') . '', $tags_list); // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings } } } endif; /** * Prints HTML with meta information for the categories. */ if ( ! function_exists( 'bloghub_post_categories' ) ) : function bloghub_post_categories() { if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list(esc_html__(', ', 'bloghub')); if ($categories_list) { /* translators: 1: list of categories. */ printf('' . esc_html__('%1$s', 'bloghub') . '', $categories_list); // phpcs:ignore WordPress.WP.I18n.NoEmptyStrings } } } endif; /** * Prints HTML with meta information for the comments. */ if ( ! function_exists( 'bloghub_comment_count' ) ) : function bloghub_comment_count() { if ( ! post_password_required() && ( comments_open() || get_comments_number() ) && get_comments_number() != 0) { echo ''; comments_popup_link('', ''.esc_html__('1', 'bloghub').' '.esc_html__('Comment', 'bloghub').'', '% '.esc_html__('Comments', 'bloghub').''); echo ''; } } endif; if ( ! function_exists( 'bloghub_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function bloghub_entry_footer() { edit_post_link( sprintf( wp_kses( /* translators: %s: Name of current post. Only visible to screen readers */ __( 'Edit %s', 'bloghub' ), array( 'span' => array( 'class' => array(), ), ) ), wp_kses_post( get_the_title() ) ), '', '' ); } endif; if ( ! function_exists( 'bloghub_post_thumbnail' ) ) : /** * Displays an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. */ function bloghub_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?>
$limit) { array_pop($words); } return implode(' ', $words); } /** * Comments Pagination */ if ( !function_exists( 'bloghub_comments_pagination' ) ) { function bloghub_comments_pagination() { the_comments_pagination( array( 'screen_reader_text' => ' ', 'prev_text' => '', 'next_text' => '', 'type' => 'list', 'mid_size' => 1, ) ); } } /** * Post Pagination */ if ( !function_exists('bloghub_Post_pagination') ) { function bloghub_Post_pagination(){ the_posts_pagination(array( 'screen_reader_text' => '', 'prev_text' => '', 'next_text' => '', 'type' => 'list', 'mid_size' => 1, )); } } /** * Prints post's first category */ if ( ! function_exists( 'bloghub_post_first_category' ) ) : function bloghub_post_first_category(){ if ( 'post' === get_post_type() ) { $post_category_list = get_the_terms(get_the_ID(), 'category'); $post_first_category = $post_category_list[0]; if ( ! empty( $post_first_category->slug )) { echo '' . $post_first_category->name . ''; } } } endif; /** * Next Preview Post Pagination */ function bloghub_post_navigation() { $prev_post = get_previous_post(); $next_post = get_next_post(); if ( ! $prev_post && ! $next_post ) { return; } ?> ID)); $protocol = is_ssl() ? 'https' : 'http'; ?>
'; $delimiter = '/'; $home = '
  • ' . esc_html__('Home', 'bloghub') . '' . $delimiter . '
  • '; if ( !is_front_page() ) { echo $home; if ( is_home() ) { echo '
  • ' . esc_html__('Blog', 'bloghub') . '
  • '; } elseif ( is_category() ) { $category = get_category(get_query_var('cat')); $cat_link = get_category_link($category->cat_ID); echo '
  • ' . esc_html($category->name) . '
  • '; } elseif ( is_single()) { $category = get_the_category(); $cat_link = get_category_link( $category[0]->cat_ID ); echo '
  • ' . esc_html( $category[0]->cat_name ) . '' . $delimiter . '
  • '; echo '
  • ' . wp_kses_post( get_the_title() ) . '
  • '; } elseif ( is_page() ) { if ( $post->post_parent ) { $anc = get_post_ancestors( $post->ID ); $anc = array_reverse( $anc ); foreach ( $anc as $ancestor ) { echo '
  • ' . get_the_title( $ancestor ) . '' . $delimiter . '
  • '; } } echo '
  • ' . esc_html( get_the_title() ) . '
  • '; } elseif ( is_author() ) { echo '
  • ' . esc_html( get_the_author_meta( 'display_name', $author_id ) ) . '
  • '; }elseif ( is_archive() ) { echo '
  • ' . esc_html( the_archive_title() ) . '
  • '; } elseif ( is_search() ) { echo '
  • ' . esc_html__( 'Search Results for', 'bloghub' ) . ': ' . esc_html( get_search_query() ) . '
  • '; } elseif ( is_tag() ) { echo '
  • ' . esc_html__( 'Tag', 'bloghub' ) . ': ' . esc_html( single_tag_title('', false) ) . '
  • '; } elseif ( is_404() ) { echo '
  • ' . esc_html__( 'Error 404', 'bloghub' ) . '
  • '; } } else { echo '
  • ' . esc_html__( 'Home', 'bloghub' ) . '
  • '; } echo ''; } endif; /** * Iframe embed */ function bloghub_iframe_embed( $tags, $context ) { if ( 'post' === $context ) { $tags['iframe'] = array( 'src' => true, 'height' => true, 'width' => true, 'frameborder' => true, 'allowfullscreen' => true, ); } return $tags; } add_filter( 'wp_kses_allowed_html', 'bloghub_iframe_embed', 10, 2 ); /** * Purchase Demo Link */ if ( ! function_exists( 'bloghub_purchase_link' ) ) { function bloghub_purchase_link() { $bloghub_purchase = 'https://www.themeuniver.com/bloghub-pro'; $description = sprintf( __( 'Purchase the Pro Version for More Features. Purchase Now', 'bloghub' ), esc_url( $bloghub_purchase ) ); return $description; } }