ID, 'kalon_sidebar_layout', true ); if( $sidebar_layout == 'no-sidebar' ) $classes[] = 'full-width'; } return $classes; } add_filter( 'body_class', 'kalon_body_classes' ); /** * Callback for Social Links */ function kalon_social_cb(){ $facebook = get_theme_mod( 'kalon_facebook' ); $twitter = get_theme_mod( 'kalon_twitter' ); $instagram = get_theme_mod( 'kalon_instagram' ); $pinterest = get_theme_mod( 'kalon_pinterest' ); $linkedin = get_theme_mod( 'kalon_linkedin' ); $youtube = get_theme_mod( 'kalon_youtube' ); if( $facebook || $twitter || $instagram || $pinterest || $linkedin || $youtube ){ ?> 'post', 'post_status' => 'publish', 'posts_per_page' => -1, 'post__in' => ( isset( $sticky_post ) && !empty( $sticky_post ) ) ? $sticky_post: array(-1), 'ignore_sticky_posts' => 1, ); $kalon_qry = new WP_Query ( $args ); if( $kalon_qry->have_posts() ){?>
is_home() && $query->is_main_query() && get_theme_mod( 'kalon_ed_slider' ) && $stickies ) { $query->set( 'post__not_in', $stickies ); $query->set( 'ignore_sticky_posts', true ); } } add_filter( 'pre_get_posts', 'kalon_exclude_sticky_post' ); /** * Callback function for Comment List * * @link https://codex.wordpress.org/Function_Reference/wp_list_comments */ function kalon_comment( $comment, $args, $depth ){ if ( 'div' == $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } ?> < id="comment-">
%s', 'kalon' ), get_comment_author_link() ); ?>
comment_approved == '0' ) : ?>
$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
', '' ); ?>

found_posts ); ?>

'; echo wp_strip_all_tags( $custom_css ); echo ''; } } add_action( 'wp_head', 'kalon_custom_css', 100 ); } if ( ! function_exists( 'kalon_excerpt_more' ) ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with ... * */ function kalon_excerpt_more( $more ) { return is_admin() ? $more : ' … '; } add_filter( 'excerpt_more', 'kalon_excerpt_more' ); endif; if ( ! function_exists( 'kalon_excerpt_length' ) ) : /** * Changes the default 55 character in excerpt */ function kalon_excerpt_length( $length ) { return 60; } add_filter( 'excerpt_length', 'kalon_excerpt_length', 999 ); endif; /** * Footer Credits */ function kalon_footer_credit(){ $copyright_text = get_theme_mod( 'kalon_footer_copyright_text' ); $text = '

'; if( $copyright_text ){ $text .= wp_kses_post( $copyright_text ).'|'; }else{ $text .= esc_html__( 'Copyright © ', 'kalon' ) . esc_html( date_i18n( __( 'Y', 'kalon' ) ) ); $text .= ' ' . esc_html( get_bloginfo( 'name' ) ) . ' | '; } $text .= esc_html__( 'Kalon by : ', 'kalon' ); $text .= '' . esc_html__( 'Rara Theme', 'kalon' ) . ' | '; $text .= sprintf( esc_html__( 'Powered by: %s', 'kalon' ), 'WordPress.' ); if ( function_exists( 'the_privacy_policy_link' ) ) { $text .= get_the_privacy_policy_link(); } $text .= '

'; echo apply_filters( 'kalon_footer_text', $text ); } add_action( 'kalon_footer', 'kalon_footer_credit' ); /** * Return sidebar layouts for pages */ function kalon_sidebar_layout(){ global $post; if( get_post_meta( $post->ID, 'kalon_sidebar_layout', true ) ){ return get_post_meta( $post->ID, 'kalon_sidebar_layout', true ); }else{ return 'right-sidebar'; } } if( ! function_exists( 'kalon_single_post_schema' ) ) : /** * Single Post Schema * * @return string */ function kalon_single_post_schema() { if ( is_singular( 'post' ) ) { global $post; $custom_logo_id = get_theme_mod( 'custom_logo' ); $site_logo = wp_get_attachment_image_src( $custom_logo_id , 'kalon-schema' ); $images = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); $excerpt = kalon_escape_text_tags( $post->post_excerpt ); $content = $excerpt === "" ? mb_substr( kalon_escape_text_tags( $post->post_content ), 0, 110 ) : $excerpt; $schema_type = ! empty( $custom_logo_id ) && has_post_thumbnail( $post->ID ) ? "BlogPosting" : "Blog"; $args = array( "@context" => "http://schema.org", "@type" => $schema_type, "mainEntityOfPage" => array( "@type" => "WebPage", "@id" => get_permalink( $post->ID ) ), "headline" => ( function_exists( '_wp_render_title_tag' ) ? wp_get_document_title() : wp_title( '', false, 'right' ) ), "image" => array( "@type" => "ImageObject", "url" => $images[0], "width" => $images[1], "height" => $images[2] ), "datePublished" => get_the_time( DATE_ISO8601, $post->ID ), "dateModified" => get_post_modified_time( DATE_ISO8601, __return_false(), $post->ID ), "author" => array( "@type" => "Person", "name" => kalon_escape_text_tags( get_the_author_meta( 'display_name', $post->post_author ) ) ), "publisher" => array( "@type" => "Organization", "name" => get_bloginfo( 'name' ), "description" => get_bloginfo( 'description' ), "logo" => array( "@type" => "ImageObject", "url" => $site_logo[0], "width" => $site_logo[1], "height" => $site_logo[2] ) ), "description" => ( class_exists('WPSEO_Meta') ? WPSEO_Meta::get_value( 'metadesc' ) : $content ) ); if ( has_post_thumbnail( $post->ID ) ) : $args['image'] = array( "@type" => "ImageObject", "url" => $images[0], "width" => $images[1], "height" => $images[2] ); endif; if ( ! empty( $custom_logo_id ) ) : $args['publisher'] = array( "@type" => "Organization", "name" => get_bloginfo( 'name' ), "description" => get_bloginfo( 'description' ), "logo" => array( "@type" => "ImageObject", "url" => $site_logo[0], "width" => $site_logo[1], "height" => $site_logo[2] ) ); endif; echo '' , PHP_EOL; } } endif; add_action( 'wp_head', 'kalon_single_post_schema' ); if( ! function_exists( 'kalon_escape_text_tags' ) ) : /** * Remove new line tags from string * * @param $text * * @return string */ function kalon_escape_text_tags( $text ) { return (string) str_replace( array( "\r", "\n" ), '', strip_tags( $text ) ); } endif; if( ! function_exists( 'kalon_change_comment_form_default_fields' ) ) : /** * Change Comment form default fields i.e. author, email & url. */ function kalon_change_comment_form_default_fields( $fields ){ // get the current commenter if available $commenter = wp_get_current_commenter(); // core functionality $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); // Change just the author field $fields['author'] = '

'; $fields['email'] = '

'; $fields['url'] = '

'; return $fields; } endif; add_filter( 'comment_form_default_fields', 'kalon_change_comment_form_default_fields' ); if( ! function_exists( 'kalon_change_comment_form_defaults' ) ) : /** * Change Comment Form defaults */ function kalon_change_comment_form_defaults( $fields ){ $comment_field = $fields['comment']; $fields['comment'] = '

';; return $fields; } endif; add_filter( 'comment_form_fields', 'kalon_change_comment_form_defaults' ); if( ! function_exists( 'wp_body_open' ) ) : /** * Fire the wp_body_open action. * Added for backwards compatibility to support pre 5.2.0 WordPress versions. */ function wp_body_open() { /** * Triggered after the opening tag. */ do_action( 'wp_body_open' ); } endif; /** * Query WooCommerce activation */ function is_woocommerce_activated() { return class_exists( 'woocommerce' ) ? true : false; }