', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'bizmax_pingback_header' ); /** * Words limit */ function bizmax_words_limit($text, $limit) { $words = explode(' ', $text, ($limit + 1)); if (count($words) > $limit) { array_pop($words); } return implode(' ', $words); } /** * Get excluded sidebar list */ if( ! function_exists( 'bizmax_sidebars' ) ) { function bizmax_sidebars() { $default = esc_html__('Default', 'bizmax'); $options = array($default); // set ids of the registered sidebars for exclude $exclude = array( 'bizmax-footer-widget', 'bizmax-toggle-sidebar' ); global $wp_registered_sidebars; if( ! empty( $wp_registered_sidebars ) ) { foreach( $wp_registered_sidebars as $sidebar ) { if( ! in_array( $sidebar['id'], $exclude ) ) { $options[$sidebar['id']] = $sidebar['name']; } } } return $options; } } /** * Iframe embed */ function bizmax_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', 'bizmax_iframe_embed', 10, 2 ); /** * Next - Prev Post Link */ if ( !function_exists( 'bizmax_next_prev_post_link' ) ) { function bizmax_next_prev_post_link(){ ?>
ID, array(85,85) ); if(!empty($prev_thumbnail)){ $prev_thumb_class ='have-thumb'; }else{ $prev_thumb_class = 'no-thumb'; } } $next_post = get_next_post(); if(!empty( get_next_post_link())){ $next_thumbnail = get_the_post_thumbnail($next_post->ID, array(85,85) ); if(!empty($next_thumbnail)){ $next_thumb_class ='have-thumb'; }else{ $next_thumb_class = 'no-thumb'; } } ?>
false ) ); // there are no custom post types if ( empty ( $custom_post_list ) ) { return false; } $custom_types = array_keys( $custom_post_list ); $current_post_type = get_post_type( $post ); // could not detect current type if ( ! $current_post_type ) { return false; } return in_array( $current_post_type, $custom_types ); } /** * Add span tag in archive list count number */ function bizmax_add_span_archive_count($links) { $links = str_replace(' (', ' (', $links); $links = str_replace(')', ')', $links); return $links; } add_filter('get_archives_link', 'bizmax_add_span_archive_count'); /** * Add span tag in category list count number */ function bizmax_add_span_category_count($links) { $links = str_replace(' (', ' (', $links); $links = str_replace(')', ')', $links); return $links; } add_filter('wp_list_categories', 'bizmax_add_span_category_count'); /** * Image id from url */ if ( ! function_exists( 'bizmax_image_id_by_url' ) ) { function bizmax_image_id_by_url($image_url) { global $wpdb; $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url)); return $attachment[0]; } } /** * Prints HTML with meta information for the current post-date/time. */ if ( ! function_exists( 'bizmax_posted_on' ) ) : function bizmax_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', 'bizmax' ), '' . $time_string . '' ); echo '' . $posted_on . ''; // WPCS: XSS OK. } endif; /** * Prints HTML with meta information for the current author. */ if ( ! function_exists( 'bizmax_posted_by' ) ) : function bizmax_posted_by() { $byline = sprintf( /* translators: %s: post author. */ esc_html_x( ' %s', 'post author', 'bizmax' ), '' . esc_html( get_the_author() ) . '' ); echo ' ' . $byline . ''; // WPCS: XSS OK. } endif; /** * Prints HTML with meta information for the tags. */ if ( ! function_exists( 'bizmax_post_tags' ) ) : function bizmax_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', 'bizmax')); if ($tags_list) { /* translators: 1: list of tags. */ printf('' .esc_html__('Tags:','bizmax').'' .esc_html__(' %1$s', 'bizmax') . '', $tags_list); // WPCS: XSS OK. } } } endif; /** * Prints HTML with meta information for the categories. */ if ( ! function_exists( 'bizmax_post_categories' ) ) : function bizmax_post_categories() { // Hide category and tag text for pages. 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__(', ', 'bizmax')); if ($categories_list) { /* translators: 1: list of categories. */ printf('' . esc_html__('%1$s', 'bizmax') . '', $categories_list); // WPCS: XSS OK. } } } endif; /** * Prints post's first category */ if ( ! function_exists( 'bizmax_post_first_category' ) ) : function bizmax_post_first_category(){ $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; /** * Prints HTML with meta information for the comments. */ if ( ! function_exists( 'bizmax_comment_count' ) ) : function bizmax_comment_count() { if ( ! post_password_required() && ( comments_open() || get_comments_number() ) && get_comments_number() != 0) { echo ''; comments_popup_link('', ''.esc_html__('1', 'bizmax').' '.esc_html__('Comment', 'bizmax').'', '% '.esc_html__('Comments', 'bizmax').''); echo ''; } } endif; /** * Allow Html */ if ( !function_exists( 'bizmax_allow_html' ) ) { function bizmax_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(), ); } }