ID; } else { return null; } } function nighty_custom_text ($content = "",$limit = 15) { $content = explode(' ', $content, $limit); if (count($content)>=$limit) { array_pop($content); $content = implode(" ",$content).'...'; } else { $content = implode(" ",$content); } $content = preg_replace('`[[^]]*]`','',$content); return strip_tags( $content ); } /** * Google Font sanitization * * @param string JSON string to be sanitized * @return string Sanitized input */ if ( ! function_exists( 'nighty_google_font_sanitization' ) ) { function nighty_google_font_sanitization( $input ) { $val = json_decode( $input, true ); if( is_array( $val ) ) { foreach ( $val as $key => $value ) { $val[$key] = sanitize_text_field( $value ); } $input = json_encode( $val ); } else { $input = json_encode( sanitize_text_field( $val ) ); } return $input; } } /* Default Primary Color in Customize */ if ( ! function_exists( 'nighty_default_primary_color' ) ) { function nighty_default_primary_color() { $primary_color = get_theme_mod( 'primary_color', '#FF494F' ); return $primary_color; } } /* Default Background in Customize */ if ( ! function_exists( 'nighty_default_primary_background' ) ) { function nighty_default_primary_background() { $primary_background = get_theme_mod( 'primary_background', '#0E0D16' ); return $primary_background; } } /* Default Primary Font in Customize */ if ( ! function_exists( 'nighty_default_primary_font' ) ) { function nighty_default_primary_font() { $customizer_defaults = json_encode( array( 'font' => 'Syne', 'regularweight' => '100,200,300,regular,500,600,700,800,900', 'category' => 'serif' ) ); return $customizer_defaults; } } if ( ! function_exists( 'nighty_woo_sidebar' ) ) { function nighty_woo_sidebar(){ if( class_exists('woocommerce') && is_product() ){ return get_theme_mod( 'woo_product_layout', 'woo_layout_1c' ); }else{ return get_theme_mod( 'woo_archive_layout', 'woo_layout_1c' ); } } } if( !function_exists( 'nighty_blog_show_media' ) ){ function nighty_blog_show_media(){ $show_media = get_theme_mod( 'blog_archive_show_media', 'yes' ); return isset( $_GET['show_media'] ) ? $_GET['show_media'] : $show_media; } } if( !function_exists( 'nighty_blog_show_title' ) ){ function nighty_blog_show_title(){ $show_title = get_theme_mod( 'blog_archive_show_title', 'yes' ); return isset( $_GET['show_title'] ) ? $_GET['show_title'] : $show_title; } } if( !function_exists( 'nighty_blog_show_date' ) ){ function nighty_blog_show_date(){ $show_date = get_theme_mod( 'blog_archive_show_date', 'yes' ); return isset( $_GET['show_date'] ) ? $_GET['show_date'] : $show_date; } } if( !function_exists( 'nighty_blog_show_cat' ) ){ function nighty_blog_show_cat(){ $show_cat = get_theme_mod( 'blog_archive_show_cat', 'yes' ); return isset( $_GET['show_cat'] ) ? $_GET['show_cat'] : $show_cat; } } if( !function_exists( 'nighty_blog_show_author' ) ){ function nighty_blog_show_author(){ $show_author = get_theme_mod( 'blog_archive_show_author', 'yes' ); return isset( $_GET['show_author'] ) ? $_GET['show_author'] : $show_author; } } if( !function_exists( 'nighty_blog_show_comment' ) ){ function nighty_blog_show_comment(){ $show_comment = get_theme_mod( 'blog_archive_show_comment', 'yes' ); return isset( $_GET['show_comment'] ) ? $_GET['show_comment'] : $show_comment; } } if( !function_exists( 'nighty_blog_show_excerpt' ) ){ function nighty_blog_show_excerpt(){ $show_excerpt = get_theme_mod( 'blog_archive_show_excerpt', 'yes' ); return isset( $_GET['show_excerpt'] ) ? $_GET['show_excerpt'] : $show_excerpt; } } if( !function_exists( 'nighty_blog_show_readmore' ) ){ function nighty_blog_show_readmore(){ $show_readmore = get_theme_mod( 'blog_archive_show_readmore', 'yes' ); return isset( $_GET['show_readmore'] ) ? $_GET['show_readmore'] : $show_readmore; } } if( !function_exists( 'nighty_post_show_media' ) ){ function nighty_post_show_media(){ $show_media = get_theme_mod( 'blog_single_show_media', 'yes' ); return isset( $_GET['show_media'] ) ? $_GET['show_media'] : $show_media; } } if( !function_exists( 'nighty_post_show_title' ) ){ function nighty_post_show_title(){ $show_title = get_theme_mod( 'blog_single_show_title', 'yes' ); return isset( $_GET['show_title'] ) ? $_GET['show_title'] : $show_title; } } if( !function_exists( 'nighty_post_show_date' ) ){ function nighty_post_show_date(){ $show_date = get_theme_mod( 'blog_single_show_date', 'yes' ); return isset( $_GET['show_date'] ) ? $_GET['show_date'] : $show_date; } } if( !function_exists( 'nighty_post_show_cat' ) ){ function nighty_post_show_cat(){ $show_cat = get_theme_mod( 'blog_single_show_cat', 'yes' ); return isset( $_GET['show_cat'] ) ? $_GET['show_cat'] : $show_cat; } } if( !function_exists( 'nighty_post_show_author' ) ){ function nighty_post_show_author(){ $show_author = get_theme_mod( 'blog_single_show_author', 'yes' ); return isset( $_GET['show_author'] ) ? $_GET['show_author'] : $show_author; } } if( !function_exists( 'nighty_post_show_comment' ) ){ function nighty_post_show_comment(){ $show_comment = get_theme_mod( 'blog_single_show_comment', 'yes' ); return isset( $_GET['show_comment'] ) ? $_GET['show_comment'] : $show_comment; } } if( !function_exists( 'nighty_post_show_tag' ) ){ function nighty_post_show_tag(){ $show_tag = get_theme_mod( 'blog_single_show_tag', 'yes' ); return isset( $_GET['show_tag'] ) ? $_GET['show_tag'] : $show_tag; } } if( !function_exists( 'nighty_post_show_share_social_icon' ) ){ function nighty_post_show_share_social_icon(){ $show_share_social_icon = get_theme_mod( 'blog_single_show_share_social_icon', 'yes' ); return isset( $_GET['show_share_social_icon'] ) ? sanitize_text_field( $_GET['show_share_social_icon'] ) : $show_share_social_icon; } }