Path : /home/vishqocm/vishalwebtech.in/blog/wp-content/themes/katerio/functions/
File Upload :
Current File : /home/vishqocm//vishalwebtech.in//blog/wp-content/themes/katerio/functions/classes.php

<?php
/**
 * Classes Element
 *
 * @package Katerio
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/*
--------------------------------------------------------------------------------
* Get Post Classes
* ------------------------------------------------------------------------------
*/
if ( ! function_exists( 'th90_get_post_class' ) ) {

	function th90_get_post_class( $classes = false, $post_id = null, $standard = false ) {

		$post = get_post( $post_id );

		if ( $standard ) {
			 $classes = join( ' ', get_post_class( $classes ) );
			 $classes = str_replace( 'hentry', '', $classes );
		}

		// Post Format
		if ( post_type_supports( $post->post_type, 'post-formats' ) ) {

			$post_format = get_post_format( $post->ID );

			if ( ! empty( $classes ) ) {
				$classes .= ' ';
			}

			if ( $post_format && ! is_wp_error( $post_format )  ) {

				$classes .= 'format-' . sanitize_html_class( $post_format );
			} else {

				$classes .= 'format-standard';
			}
		}

		// Sticky
		if ( is_sticky( $post_id ) && is_home() && ! is_paged() ) {

			if ( ! empty( $classes ) ) {
				$classes .= ' ';
			}

			$classes .= 'sticky';
		}

		if ( ! empty( $classes ) ) {
			return $classes;
		}
	}
}

/*
--------------------------------------------------------------------------------
* Print Post Classes
* ------------------------------------------------------------------------------
*/
if ( ! function_exists( 'th90_post_class' ) ) {

	function th90_post_class( $classes = false, $post_id = null, $standard = false ) {

		$classes = th90_get_post_class( $classes, $post_id, $standard );

		if ( ! empty( $classes ) ) {
			echo 'class="post-layout ' . $classes . '"';
		}
	}
}

/*
--------------------------------------------------------------------------------
* Body classes
* ------------------------------------------------------------------------------
*/
if ( ! function_exists( 'th90_body_class' ) ) {

	function th90_body_class( $classes ) {

		$post = get_post();
		$classes[] = ! is_singular() ? 'hfeed' : '';
		$classes[] = 'site-skin';
		$classes[] = th90_is_amp() ? 'site-stretch' : 'site-' . th90_opt( 'site_layout' );
		$classes[] = 'site-' . th90_opt( 'content_bg' );
		$classes[] = th90_lazyload_check() ? 'is-lazyload' : '';
		$classes[] = 'content-link-' . th90_opt( 'post_content_link_style' );
		$classes[] = 'title-hov-' . th90_opt( 'title_hover' );
		$classes[] = th90_opt( 'skin_trigger' ) ? 'have-skin-trigger' : '';
		$classes[] = th90_opt( 'image_grayscale' ) ? 'image-grayscale' : '';
		$classes[] = th90_opt( 'post_excerpt_div' ) ? 'have-excerpt-div' : '';
		$classes[] = th90_is_sticky_header() ? 'sticky-header-active' : '';
		$classes[] = is_singular('post') && th90_opt( 'reading_indicator' ) ? 'reading-indicator-' . th90_opt( 'reading_indicator_pos' ) : '';
		$classes[] = th90_opt( 'disable_lazyload_img_placeholder' ) ? 'lazy-no-placeholder' : 'lazy-is-placeholder';
		return $classes;
	}
}
add_filter( 'body_class', 'th90_body_class' );

/*
--------------------------------------------------------------------------------
* Content classes
* ------------------------------------------------------------------------------
*/
if ( ! function_exists( 'th90_content_class' ) ) {

	function th90_content_class( $class = '' ) {
		$classes = array(
			'site-content',
			! th90_is_builder_page() ? 'is-skin' : '',
			! th90_is_builder_page() ? 'bg-' . th90_opt( 'content_bg' ) : '',
			! th90_is_builder_page() && th90_opt( 'content_bg_custom' ) ? 'bg-custom' : '',
			$class,
		);

		echo 'id="content" class="'. implode( ' ', array_filter( $classes ) ) .'"';
	}
}