', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'articlewave_pingback_header' ); /** * Filters for the sticky sidebar */ function custom_sidebar_sticky( $sidebar_sticky ) { return $sidebar_sticky; } add_filter('articlewave_sidebar_sticky_filter', 'custom_sidebar_sticky'); /** * Filters for the sticky header */ function custom_header_sticky( $header_sticky ) { return $header_sticky; } add_filter('articlewave_header_sticky_filter', 'custom_header_sticky'); /** * Check if there is logo or not */ if ( ! function_exists( 'articlewave_get_logo_site_class' ) ) : function articlewave_get_logo_site_class() { if ( ! has_custom_logo() && ! display_header_text() ) { return 'no-logo-site'; } elseif ( ! has_custom_logo() && display_header_text() ) { return 'has-site-info'; } else { return 'logo-site'; } } endif; function articlewave_scripts() { wp_enqueue_style( 'articlewave-fonts', articlewave_google_font_callback(), array(), null ); wp_enqueue_style( 'articlewave-style', get_stylesheet_uri(), array(), ARTICLEWAVE_VERSION ); wp_enqueue_style( 'articlewave-responsive-style', get_template_directory_uri() . '/assets/css/articlewave-responsive.css', array(), ARTICLEWAVE_VERSION ); wp_enqueue_style( 'articlewave-preloader-style', get_template_directory_uri() . '/assets/css/articlewave-preloader.css', array(), ARTICLEWAVE_VERSION ); wp_enqueue_style( 'box-icons', get_template_directory_uri() . '/assets/library/box-icons/css/boxicons.css', array(), ARTICLEWAVE_VERSION ); wp_enqueue_style( 'lightslider', get_template_directory_uri() . '/assets/library/lightslider/css/lightslider.css', array(), '1.1.6' ); wp_enqueue_script( 'lightslider', get_template_directory_uri() . '/assets/library/lightslider/js/lightslider.js', array(), '1.1.6', true ); wp_enqueue_script( 'jquery-sticky-sidebar', get_template_directory_uri() . '/assets/library/sticky-sidebar/theia-sticky-sidebar.min.js', array(), ARTICLEWAVE_VERSION, true ); wp_enqueue_script( 'jquery-sticky', get_template_directory_uri() . '/assets/library/sticky/jquery.sticky.min.js', array( 'jquery' ), ARTICLEWAVE_VERSION, true ); wp_enqueue_script( 'imagesloaded' ); wp_enqueue_script( 'masonry' ); wp_enqueue_script( 'articlewave-custom-scripts', get_template_directory_uri() . '/assets/js/custom-scripts.js', array( 'jquery'), ARTICLEWAVE_VERSION, true ); $header_sticky = apply_filters( 'articlewave_header_sticky_filter', 'true' ); $sidebar_sticky = apply_filters( 'articlewave_sidebar_sticky_filter', 'true' ); $articlewave_search_option = get_theme_mod( 'articlewave_search_option', 'live-search' ); $live_search = ( $articlewave_search_option == 'live-search' ) ? 'true' : 'false'; wp_localize_script( 'articlewave-custom-scripts', 'MT_JSObject', array( 'header_sticky' => $header_sticky, 'sidebar_sticky' => $sidebar_sticky, 'live_search' => $live_search, 'ajaxUrl' => admin_url('admin-ajax.php'), '_wpnonce' => wp_create_nonce('articlewave-nonce') ) ); wp_enqueue_script( 'articlewave-navigation', get_template_directory_uri() . '/js/navigation.js', array(), ARTICLEWAVE_VERSION , true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts' , 'articlewave_scripts' ); if ( ! function_exists( 'articlewave_admin_scripts' ) ) : /** * Enqueue admin scripts and styles. */ function articlewave_admin_scripts( $hook ) { // Only needed on these admin screens if ( $hook != 'edit.php' && $hook != 'post.php' && $hook != 'post-new.php' && 'widgets.php' != $hook ) { return; } wp_enqueue_style( 'articlewave-widget-style', get_template_directory_uri() . '/inc/widgets/assets/css/widget-admin-style.css', array(), ARTICLEWAVE_VERSION ); wp_enqueue_script( 'articlewave-widget-script', get_template_directory_uri() . '/inc/widgets/assets/js/widget-admin-script.js', array( 'jquery' ), ARTICLEWAVE_VERSION, true ); } endif; add_action( 'admin_enqueue_scripts', 'articlewave_admin_scripts' ); if ( ! function_exists( 'articlewave_social_icons_array' ) ) : /** * List of box icons * * @return array(); * @since 1.0.0 */ function articlewave_social_icons_array() { return array( "bx bxl-facebook", "bx bxl-facebook-circle", "bx bxl-facebook-square", "bx bxl-twitter", "bx bxl-google", "bx bxl-google-plus", "bx bxl-google-plus-circle", "bx bxl-google-cloud", "bx bxl-instagram", "bx bxl-instagram-alt", "bx bxl-skype", "bx bxl-whatsapp", "bx bxl-whatsapp-square", "bx bxl-tiktok", "bx bxl-airbnb", "bx bxl-deviantart", "bx bxl-linkedin", "bx bxl-linkedin-square", "bx bxl-pinterest", "bx bxl-pinterest-alt", "bx bxl-adobe", "bx bxl-flickr", "bx bxl-flickr-square", "bx bxl-tumblr", "bx bxl-slack", "bx bxl-reddit", "bx bxl-messenger", "bx bxl-wordpress", "bx bxl-behance", "bx bxl-dribbble", "bx bxl-yahoo", "bx bxl-blogger", "bx bxl-snapchat", "bx bxl-wix", "bx bxl-meta", "bx bxl-baidu", "bx bxl-discord", "bx bxl-twitch", "bx bxl-discord-alt", "bx bxl-vk", "bx bxl-trip-advisor", "bx bxl-telegram", "bx bxl-quora", "bx bxl-ok-ru", "bx bxl-microsoft-teams", "bx bxl-foursquare", "bx bxl-soundcloud", "bx bxl-vimeo", "bx bxl-digg", "bx bxl-periscope", "bx bxl-xing", "bx bxl-youtube", "bx bxl-imdb", ); } endif; if ( ! function_exists( 'articlewave_minify_css' ) ) { /** * Minify CSS * * @since 1.0.0 */ function articlewave_minify_css( $css = '' ) { // Return if no CSS if ( ! $css ) return; // Normalize whitespace $css = preg_replace( '/\s+/', ' ', $css ); // Remove ; before } $css = preg_replace( '/;(?=\s*})/', '', $css ); // Remove space after , : ; { } */ > $css = preg_replace( '/(,|:|;|\{|}|\*\/|>) /', '$1', $css ); // Remove space before , ; { } $css = preg_replace( '/ (,|;|\{|})/', '$1', $css ); // Strips leading 0 on decimal values (converts 0.5px into .5px) $css = preg_replace( '/(:| )0\.([0-9]+)(%|em|ex|px|in|cm|mm|pt|pc)/i', '${1}.${2}${3}', $css ); // Strips units if value is 0 (converts 0px to 0) $css = preg_replace( '/(:| )(\.?)0(%|em|ex|px|in|cm|mm|pt|pc)/i', '${1}0', $css ); // Trim $css = trim( $css ); // Return minified CSS return $css; } } if ( ! function_exists( 'articlewave_get_google_font_variants' ) ) : /** * get Google font variants * * @since 1.0.0 */ function articlewave_get_google_font_variants() { $articlewave_font_list = get_option( 'articlewave_google_font' ); $font_family = $_REQUEST['font_family']; $variants_array = $articlewave_font_list[$font_family]['0']; $options_array = ''; foreach ( $variants_array as $variant ) { $variant_html = articlewave_convert_font_variants( $variant ); $options_array .= ''; } echo $options_array; die(); } endif; add_action( "wp_ajax_get_google_font_variants", "articlewave_get_google_font_variants" ); if ( ! function_exists( 'articlewave_convert_font_variants' ) ) : /** * function to manage the variant name according to their value. * * @param $value - string * @return string - variant name * @since 1.0.0 */ function articlewave_convert_font_variants( $value ) { switch ( $value ) { case '100': return __( 'Thin 100', 'articlewave' ); break; case '100italic': return __( 'Thin 100 Italic', 'articlewave' ); break; case '200': return __( 'Extra-Light 200', 'articlewave' ); break; case '200italic': return __( 'Extra-Light 200 Italic', 'articlewave' ); break; case '300': return __( 'Light 300', 'articlewave' ); break; case '300italic': return __( 'Light 300 Italic', 'articlewave' ); break; case '400': return __( 'Normal 400', 'articlewave' ); break; case 'italic': return __( 'Normal 400 Italic', 'articlewave' ); break; case '400italic': return __( 'Normal 400 Italic', 'articlewave' ); break; case '500': return __( 'Medium 500', 'articlewave' ); break; case '500italic': return __( 'Medium 500 Italic', 'articlewave' ); break; case '600': return __( 'Semi-Bold 600', 'articlewave' ); break; case '600italic': return __( 'Semi-Bold 600 Italic', 'articlewave' ); break; case '700': return __( 'Bold 700', 'articlewave' ); break; case '700italic': return __( 'Bold 700 Italic', 'articlewave' ); break; case '800': return __( 'Extra-Bold 800', 'articlewave' ); break; case '800italic': return __( 'Extra-Bold 800 Italic', 'articlewave' ); break; case '900': return __( 'Ultra-Bold 900', 'articlewave' ); break; case '900italic': return __( 'Ultra-Bold 900 Italic', 'articlewave' ); break; case 'inherit': return __( 'Inherit', 'articlewave' ); break; default: break; } } endif; if ( ! function_exists( 'articlewave_google_font_callback' ) ) : /** * Load google fonts api link * * @since 1.0.0 */ function articlewave_google_font_callback() { $articlewave_get_font_list = get_option( 'articlewave_google_font' ); if ( empty( $articlewave_get_font_list ) ) { $query_args = array( 'family' => urlencode( 'Roboto' ), 'subset' => urlencode( 'latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic,khmer,devanagari,arabic,hebrew,telugu' ) ); $google_fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); return $google_fonts_url; } $articlewave_body_font_family = articlewave_get_customizer_option_value( 'articlewave_body_font_family' ); $articlewave_body_font_weight = implode( ',', $articlewave_get_font_list[$articlewave_body_font_family]['0'] ); $body_typo_combo = $articlewave_body_font_family.":".$articlewave_body_font_weight; $articlewave_heading_font_family = articlewave_get_customizer_option_value( 'articlewave_heading_font_family' ); $articlewave_heading_font_weight = implode( ',', $articlewave_get_font_list[$articlewave_heading_font_family]['0'] ); $heading_typo_combo = $articlewave_heading_font_family.":".$articlewave_heading_font_weight; $get_fonts = array( $body_typo_combo, $heading_typo_combo ); $final_font_string = implode( '|', $get_fonts ); $google_fonts_url = ''; if ( $final_font_string ) { $query_args = array( 'family' => urlencode( $final_font_string ), 'subset' => urlencode( 'latin,cyrillic-ext,greek-ext,greek,vietnamese,latin-ext,cyrillic,khmer,devanagari,arabic,hebrew,telugu' ) ); $google_fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return $google_fonts_url; } endif; if ( ! function_exists( 'articlewave_get_actual_font_weight' ) ) : /** * get font weight in integer */ function articlewave_get_actual_font_weight( $font_weight ) { if ( 'regular' == $font_weight ) { $font_weight = '400'; } elseif ( 'italic' == $font_weight ) { $font_weight = '400italic'; } return $font_weight; } endif; if ( ! function_exists( 'articlewave_get_date_format_args' ) ) : /** * Generate date format array for query arguments * * @return array * @since 1.0.0 */ function articlewave_get_date_format_args( $format ) { switch( $format ) { case 'today': $today_date = getdate(); $get_args = array( 'year' => $today_date['year'], 'month' => $today_date['mon'], 'day' => $today_date['mday'], ); return $get_args ; break; case 'this-week': $get_args = array( 'year' => date( 'Y' ), 'week' => date( 'W' ) ); return $get_args; break; case 'last-week': $this_week = date( 'W' ); if ( $this_week != 1 ) { $last_week = $this_week - 1; } else { $last_week = 52; } $this_year = date( 'Y' ); if ( $last_week != 52 ) { $this_year = date( 'Y' ); } else { $this_year = date( 'Y' ) -1; } $get_args = array( 'year' => $this_year, 'week' => $last_week ); return $get_args; break; case 'this-month': $today_date = getdate(); $get_args = array( 'month' => $today_date['mon'] ); return $get_args; break; case 'last-month': $this_date = getdate(); if ( $this_date['mon'] != 1 ) { $last_month = $this_date['mon'] - 1; } else { $last_month = 12; } $this_year = date( 'Y' ); if ( $last_month != 12 ) { $this_year = date('Y'); } else { $this_year = date('Y') - 1; } $get_args = array( 'year' => $this_year, 'month' => $last_month ); return $get_args; break; default: return []; } } endif; if (!function_exists('articlewave_search_posts_content')) : /** * Ajax call for live search * * @return array * @since 1.0.0 */ function articlewave_search_posts_content() { check_ajax_referer('articlewave-nonce', 'security'); $search_key = isset( $_POST['search_key'] ) ? sanitize_text_field( $_POST['search_key'] ) : '' ; $query_vars = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 4, 's' => $search_key, ); $n_posts = new WP_Query( $query_vars ); $res['loaded'] = false; ob_start(); echo '