', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'pliska_pingback_header' ); /** * Check if it is a content type that lists blog posts, including the taxonomy archives (categories, tags, etc.). */ function pliska_is_blog() { return ( is_archive() || is_author() || is_category() || is_home() || is_tag() ) && 'post' == get_post_type(); } /** * Add option to add site logo from the customizer * * @since WordPress 4.5 * provides shim for wp versions older than 4.5 */ function pliska_the_logo() { if ( ! function_exists( 'the_custom_logo' ) ) { return; } the_custom_logo(); } /** * Replaces "[...]" (appended to automatically generated excerpts) with ... and * a 'Read More' link. * * @since pliska 0.0.1 * * @param string $link Link to single post/page. * @return string 'Read More' link prepended with an ellipsis. */ function pliska_excerpt_more( $link ) { if ( is_admin() ) { return $link; } $link = sprintf( '%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( 'Read more "%1$s"', 'pliska' ), esc_html( get_the_title( get_the_ID() ) ) ) ); return '' . $link; } add_filter( 'excerpt_more', 'pliska_excerpt_more' ); // Control Excerpt Length function pliska_custom_excerpt_length( $length ) { return 15; } add_filter( 'excerpt_length', 'pliska_custom_excerpt_length', 999 ); /** * Add spinner */ function pliska_preloader() { if ( is_front_page() || is_home() || is_customize_preview() ) : ?>
2, 'prev_text' => '«', 'next_text' => '»', ) ); } /* Post navigation in single.php */ function pliska_the_post_navigation() { $pliska_prev_arrow = '<'; $pliska_next_arrow = '>'; the_post_navigation( array( 'prev_text' => '' . $pliska_prev_arrow . ' %title', 'next_text' => '%title ' . '' . $pliska_next_arrow . '', 'screen_reader_text' => __( 'Posts navigation', 'pliska' ), ) ); } /** * Adds Schema.org structured data (microdata) to the HTML markup * More details at http://schema.org * Testing tools at https://developers.google.com/structured-data/testing-tool/ */ function pliska_schema_microdata( $location = '', $echo = 1 ) { $output = ''; switch ( $location ) { case 'body': $output = 'itemscope itemtype="http://schema.org/WebPage"'; break; case 'header': $output = 'itemscope itemtype="http://schema.org/WPHeader"'; break; case 'blog': $output = 'itemscope itemtype="http://schema.org/Blog"'; break; case 'element': $output = 'itemscope itemtype="http://schema.org/WebPageElement"'; break; case 'sidebar': $output = 'itemscope itemtype="http://schema.org/WPSideBar"'; break; case 'footer': $output = 'itemscope itemtype="http://schema.org/WPFooter"'; break; case 'mainEntityOfPage': $output = 'itemprop="mainEntityOfPage"'; break; case 'breadcrumbs': $output = 'itemprop="breadcrumb"'; break; case 'menu': $output = 'itemscope itemtype="http://schema.org/SiteNavigationElement"'; break; /* SITE HEADER */ case 'site-title': $output = 'itemprop="headline"'; break; case 'site-description': $output = 'itemprop="description"'; break; /* MAIN CONTENT - BLOG */ case 'blogpost': // archive/blog pages $output = 'itemscope itemtype="http://schema.org/BlogPosting" itemprop="blogPost"'; break; case 'article': // single pages single.php, page.php, image.php $output = 'itemscope itemtype="http://schema.org/Article" itemprop="mainEntity"'; break; case 'entry-title': $output = 'itemprop="headline"'; break; case 'url': $output = 'itemprop="url"'; break; case 'entry-summary': $output = 'itemprop="description"'; break; case 'entry-content': $output = 'itemprop="articleBody"'; break; case 'text': $output = 'itemprop="text"'; break; case 'comment': $output = 'itemscope itemtype="http://schema.org/Comment"'; break; case 'comment-author': $output = 'itemscope itemtype="http://schema.org/Person" itemprop="creator"'; break; /* POST META */ case 'author': $output = 'itemscope itemtype="http://schema.org/Person" itemprop="author"'; break; case 'author-url': $output = 'itemprop="url"'; break; case 'author-name': $output = 'itemprop="name"'; break; case 'author-description': $output = 'itemprop="description"'; break; case 'time': $output = 'itemprop="datePublished"'; break; case 'time-modified': $output = 'itemprop="dateModified"'; break; case 'category': $output = ''; break; case 'tags': $output = 'itemprop="keywords"'; break; case 'comment-meta': $output = 'itemprop="discussionURL"'; break; case 'image': $output = 'itemprop="image" itemscope itemtype="http://schema.org/ImageObject"'; break; } // switch $output = ' ' . $output; if ( $echo ) { echo $output; } else { return $output; } } /** * Gravatar Alt Tags Fix * * @link https://wphelper.site/fix-missing-gravatar-alt-tag-value/ */ function pliska_gravatar_alt( $text ) { $alt = get_the_author_meta( 'display_name' ); $text = str_replace( 'alt=\'\'', 'alt=\'Avatar ' . $alt . '\' title=\'Gravatar ' . $alt . '\'', $text ); return $text; } add_filter( 'get_avatar', 'pliska_gravatar_alt' ); /** * Properly escape svg output * * @link https://wordpress.stackexchange.com/questions/312625/escaping-svg-with-kses */ function pliska_get_kses_extended_ruleset() { $kses_defaults = wp_kses_allowed_html( 'post' ); $svg_args = array( 'svg' => array( 'class' => true, 'aria-hidden' => true, 'aria-labelledby' => true, 'role' => true, 'xmlns' => true, 'width' => true, 'height' => true, 'stroke' => true, 'stroke-width' => true, 'fill' => true, 'stroke-linecap' => true, 'stroke-linejoin' => true, 'viewbox' => true, // <= Must be lower case! ), 'circle' => array( 'cx' => true, 'cy' => true, 'r' => true, ), 'line' => array( 'x1' => true, 'y1' => true, 'x2' => true, 'y2' => true, ), 'polyline' => array( 'points' => true ), 'g' => array( 'fill' => true ), 'title' => array( 'title' => true ), 'path' => array( 'd' => true, 'fill' => true, ), ); return array_merge( $kses_defaults, $svg_args ); } /** * Get Page title letters length * used to calculate site title typewriter animation */ function pliska_get_page_title_length() { $page_title_length = ''; if ( is_front_page() && is_home() ) { // Default homepage $page_title_length = strlen( get_bloginfo( 'name' ) ); } elseif ( is_front_page()){ // Static homepage $page_title_length = strlen( get_the_title() ); } elseif ( is_home()){ // Blog page $page_title_length = strlen( get_the_title( get_option('page_for_posts', true) )); } else if ( function_exists( 'is_shop' ) && is_shop() ) { // Woocommerce Shop Page $page_title_length = strlen(wp_kses( get_the_title( wc_get_page_id( 'shop' ) ), array() )); } elseif (is_archive()) { // Post Archives $page_title_length = strlen(wp_kses( get_the_archive_title(), array() ) ); } else { // Everything else $page_title_length = strlen( get_the_title() ); } return $page_title_length; } /** * Register 1000 + Google Fonts * @since 0.0.1 */ function pliska_font_family() { $google_fonts = array(); $url = 'https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyDwe8tl4YMbg8asbjzbXDDFuxzR1Wm9EQ0'; $response = wp_remote_get( 'http://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyDwe8tl4YMbg8asbjzbXDDFuxzR1Wm9EQ0', array( 'sslverify' => true ) ); $response = wp_remote_retrieve_body( wp_remote_get( $url, array( 'sslverify' => false ) ) ); if ( is_wp_error( $response ) ) { echo 'Something went wrong!'; } else { $json_a = json_decode( $response, true ); $font_items = $json_a['items']; if ( ! $font_items ) { return; } foreach ( $font_items as $font_value => $font_item ) { $google_fonts[ $font_item['family'] ] = $font_item['family']; } } return ( $google_fonts ); } /* Register google fonts */ /** * Register custom fonts. * Combine headings and body custom fonts in one http request. * * @link https://wordpress.org/themes/new-york-business/ */ function pliska_fonts_url() { $fonts_url = ''; /* * Translators: If there are characters in your language that are not * supported by "Open Sans", sans-serif;, translate this to 'off'. Do not translate * into your own language. */ $typography = _x( 'on', 'Open Sans font: on or off', 'pliska' ); if ( 'off' !== $typography ) { $font_families = array(); $font_families[] = wp_strip_all_tags( get_theme_mod( 'headings_fontfamily', 'Rubik' ) ) . ':500,700,900'; $font_families[] = wp_strip_all_tags( get_theme_mod( 'body_fontfamily', 'IBM Plex Sans' ) ) . ':300,400'; $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), 'pliska' => urlencode( 'swap' ), ); $fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' ); } return esc_url( $fonts_url ); } /** * Load Google Fonts. Add preload and preconnect for performance * * @since pliska .0.1 * * @param array $urls URLs to print for resource hints. * @param string $relation_type The relation type the URLs are printed. * @return array $urls URLs to print for resource hints. */ // Add resource hints to our Google fonts call. if ( ! function_exists( 'pliska_resource_hints' ) ) { function pliska_resource_hints( $urls, $relation_type ) { if ( wp_style_is( 'pliska-fonts', 'queue' ) && 'preconnect' === $relation_type ) { if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { $urls[] = array( 'href' => 'https://fonts.gstatic.com', 'crossorigin', ); } else { $urls[] = 'https://fonts.gstatic.com'; } } return $urls; } add_filter( 'wp_resource_hints', 'pliska_resource_hints', 10, 2 ); } //load the fonts function pliska_enqueue_fonts() { // Enter the URL of your Google Fonts generated from https://fonts.google.com/ here. $google_fonts_url = pliska_fonts_url(); wp_enqueue_style( 'pliska-fonts', $google_fonts_url, array(), PLISKA_VERSION); } add_action('wp_enqueue_scripts', 'pliska_enqueue_fonts'); // load fonts asynchronously function pliska_add_stylesheet_attributes_to_fonts( $html, $handle ) { if ( 'pliska-fonts' === $handle) { return str_replace( "rel='stylesheet'", "rel='stylesheet' media=\"print\" onload=\"this.media='all'\"", $html ); } return $html; } add_filter( 'style_loader_tag', 'pliska_add_stylesheet_attributes_to_fonts', 10, 2 ); function pliska_social_posts_share() { $social_share = get_theme_mod( 'show_post_share_btns', 1 ); if ( $social_share || is_customize_preview() ) : global $post; $pin_image = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); ?>

wp_get_post_categories( get_the_ID() ), 'posts_per_page' => 3, 'post__not_in' => array( get_the_ID() ), ) ); if ( $related->have_posts() ) { ?>