implode('&family=', $font_families), 'display' => 'swap', ), 'https://fonts.googleapis.com/css2'); return esc_url_raw($fonts_url); } endif; if (!function_exists('silvermountain_sanitize_sidebar_option_meta')) : // Sidebar Option Sanitize. function silvermountain_sanitize_sidebar_option_meta($input) { $metabox_options = array('global-sidebar', 'left-sidebar', 'right-sidebar', 'no-sidebar'); if (in_array($input, $metabox_options)) { return $input; } else { return ''; } } endif; if (!function_exists('silvermountain_page_lists')) : // Page List. function silvermountain_page_lists() { $page_lists = array(); $page_lists[''] = esc_html__('-- Select Page --', 'silvermountain'); $pages = get_pages( array( 'parent' => 0, // replaces 'depth' => 1, ) ); foreach ($pages as $page) { $page_lists[$page->ID] = $page->post_title; } return $page_lists; } endif; if (!function_exists('silvermountain_sanitize_post_layout_option_meta')) : // Sidebar Option Sanitize. function silvermountain_sanitize_post_layout_option_meta($input) { $metabox_options = array('global-layout', 'layout-1', 'layout-2'); if (in_array($input, $metabox_options)) { return $input; } else { return ''; } } endif; if (!function_exists('silvermountain_sanitize_header_overlay_option_meta')) : // Sidebar Option Sanitize. function silvermountain_sanitize_header_overlay_option_meta($input) { $metabox_options = array('global-layout', 'enable-overlay'); if (in_array($input, $metabox_options)) { return $input; } else { return ''; } } endif; /** * SilverMountain SVG Icon helper functions * * @package SilverMountain * @since 1.0.0 */ if (!function_exists('silvermountain_theme_svg')): /** * Output and Get Theme SVG. * Output and get the SVG markup for an icon in the SilverMountain_SVG_Icons class. * * @param string $svg_name The name of the icon. * @param string $group The group the icon belongs to. * @param string $color Color code. */ function silvermountain_theme_svg($svg_name, $return = false) { if ($return) { return silvermountain_get_theme_svg($svg_name); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in silvermountain_get_theme_svg();. } else { echo silvermountain_get_theme_svg($svg_name); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in silvermountain_get_theme_svg();. } } endif; if (!function_exists('silvermountain_get_theme_svg')): /** * Get information about the SVG icon. * * @param string $svg_name The name of the icon. * @param string $group The group the icon belongs to. * @param string $color Color code. */ function silvermountain_get_theme_svg($svg_name) { // Make sure that only our allowed tags and attributes are included. $svg = wp_kses( SilverMountain_SVG_Icons::get_svg($svg_name), array( 'svg' => array( 'class' => true, 'xmlns' => true, 'width' => true, 'height' => true, 'viewbox' => true, 'aria-hidden' => true, 'role' => true, 'focusable' => true, ), 'path' => array( 'fill' => true, 'fill-rule' => true, 'd' => true, 'transform' => true, ), 'polygon' => array( 'fill' => true, 'fill-rule' => true, 'points' => true, 'transform' => true, 'focusable' => true, ), 'line' => array( 'stroke' => true, 'x1' => true, 'x2' => true, 'y1' => true, 'y2' => true, ), ) ); if (!$svg) { return false; } return $svg; } endif; if (!function_exists('silvermountain_svg_escape')): /** * Get information about the SVG icon. * * @param string $svg_name The name of the icon. * @param string $group The group the icon belongs to. * @param string $color Color code. */ function silvermountain_svg_escape($input) { // Make sure that only our allowed tags and attributes are included. $svg = wp_kses( $input, array( 'svg' => array( 'class' => true, 'xmlns' => true, 'width' => true, 'height' => true, 'viewbox' => true, 'aria-hidden' => true, 'role' => true, 'focusable' => true, ), 'path' => array( 'fill' => true, 'fill-rule' => true, 'd' => true, 'transform' => true, ), 'polygon' => array( 'fill' => true, 'fill-rule' => true, 'points' => true, 'transform' => true, 'focusable' => true, ), ) ); if (!$svg) { return false; } return $svg; } endif; if (!function_exists('silvermountain_social_menu_icon')) : function silvermountain_social_menu_icon($item_output, $item, $depth, $args) { // Add Icon if (isset($args->theme_location) && 'silvermountain-social-menu' === $args->theme_location) { $svg = SilverMountain_SVG_Icons::get_theme_svg_name($item->url); if (empty($svg)) { $svg = silvermountain_theme_svg('link', $return = true); } $item_output = str_replace($args->link_after, '' . $svg, $item_output); } return $item_output; } endif; add_filter('walker_nav_menu_start_el', 'silvermountain_social_menu_icon', 10, 4); if (!function_exists('silvermountain_sub_menu_toggle_button')) : function silvermountain_sub_menu_toggle_button($args, $item, $depth) { // Add sub menu toggles to the main menu with toggles if ($args->theme_location == 'silvermountain-primary-menu' && isset($args->show_toggles)) { // Wrap the menu item link contents in a div, used for positioning $args->before = '
'; // Add sub menu icons to the main menu without toggles (the fallback menu) } elseif ($args->theme_location == 'silvermountain-primary-menu') { if (in_array('menu-item-has-children', $item->classes)) { $args->before = ' '; } else { $args->before = ''; $args->after = ''; } } return $args; } add_filter('nav_menu_item_args', 'silvermountain_sub_menu_toggle_button', 10, 3); endif; if (!function_exists('silvermountain_post_category_list')) : // Post Category List. function silvermountain_post_category_list($select_cat = true) { $post_cat_lists = get_categories( array( 'hide_empty' => '0', 'exclude' => '1', ) ); $post_cat_cat_array = array(); if ($select_cat) { $post_cat_cat_array[''] = esc_html__('Select Category', 'silvermountain'); } foreach ($post_cat_lists as $post_cat_list) { $post_cat_cat_array[$post_cat_list->slug] = $post_cat_list->name; } return $post_cat_cat_array; } endif; if (!function_exists('silvermountain_sanitize_meta_pagination')): /** Sanitize Enable Disable Checkbox **/ function silvermountain_sanitize_meta_pagination($input) { $valid_keys = array('global-layout', 'no-navigation', 'norma-navigation', 'ajax-next-post-load'); if (in_array($input, $valid_keys)) { return $input; } return ''; } endif; if (!function_exists('silvermountain_disable_post_views')): /** Disable Post Views **/ function silvermountain_disable_post_views() { add_filter('booster_extension_filter_views_ed', 'silvermountain_disable_views_ed'); } endif; if (!function_exists('silvermountain_disable_views_ed')): /** Disable Reaction **/ function silvermountain_disable_views_ed() { return false; } endif; if (!function_exists('silvermountain_disable_post_read_time')): /** Disable Read Time **/ function silvermountain_disable_post_read_time() { add_filter('booster_extension_filter_readtime_ed', 'silvermountain_disable_read_time'); } endif; if (!function_exists('silvermountain_disable_read_time')): /** Disable Reaction **/ function silvermountain_disable_read_time() { return false; } endif; if (!function_exists('silvermountain_disable_post_like_dislike')): /** Disable Like Dislike **/ function silvermountain_disable_post_like_dislike() { add_filter('booster_extension_filter_like_ed', 'silvermountain_disable_like_ed'); } endif; if (!function_exists('silvermountain_disable_like_ed')): /** Disable Reaction **/ function silvermountain_disable_like_ed() { return false; } endif; if (!function_exists('silvermountain_disable_post_author_box')): /** Disable Author Box **/ function silvermountain_disable_post_author_box() { add_filter('booster_extension_filter_ab_ed', 'silvermountain_disable_ab_ed'); } endif; if (!function_exists('silvermountain_disable_ab_ed')): /** Disable Reaction **/ function silvermountain_disable_ab_ed() { return false; } endif; add_filter('booster_extension_filter_ss_ed', 'silvermountain_disable_social_share'); if (!function_exists('silvermountain_disable_social_share')): /** Disable Reaction **/ function silvermountain_disable_social_share() { return false; } endif; if (!function_exists('silvermountain_disable_post_reaction')): /** Disable Reaction **/ function silvermountain_disable_post_reaction() { add_filter('booster_extension_filter_reaction_ed', 'silvermountain_disable_reaction_cb'); } endif; if (!function_exists('silvermountain_disable_reaction_cb')): /** Disable Reaction **/ function silvermountain_disable_reaction_cb() { return false; } endif; if (!function_exists('silvermountain_header_ad')): function silvermountain_header_ad() { $silvermountain_default = silvermountain_get_default_theme_options(); $ed_header_ad = get_theme_mod('ed_header_ad', $silvermountain_default['ed_header_ad']); $header_ad_image = get_theme_mod('header_ad_image'); $ed_header_link = get_theme_mod('ed_header_link'); if ($ed_header_ad) { ?> ID)) { $prev_link = get_permalink($prev_post->ID); ?> ID)) { $next_link = get_permalink($next_post->ID); ?> ID; if ($twp_navigation_type == '' || $twp_navigation_type == 'global-layout') { $twp_navigation_type = get_theme_mod('twp_navigation_type', $silvermountain_default['twp_navigation_type']); } if ($silvermountain_header_trending_page != $current_id && $silvermountain_header_popular_page != $current_id) { if ($twp_navigation_type != 'no-navigation' && 'post' === get_post_type()) { if ($twp_navigation_type == 'norma-navigation') { ?> ID)) { $next_post_id = $next_post->ID; echo ''; } } } } } endif; add_action('silvermountain_navigation_action', 'silvermountain_single_post_navigation', 30); if (!function_exists('silvermountain_header_banner')): function silvermountain_header_banner() { global $post; if (have_posts()): while (have_posts()) : the_post(); global $post; endwhile; endif; $silvermountain_post_layout = ''; $silvermountain_default = silvermountain_get_default_theme_options(); if (is_singular()) { $silvermountain_post_layout = esc_html(get_post_meta($post->ID, 'silvermountain_post_layout', true)); if ($silvermountain_post_layout == '' || $silvermountain_post_layout == 'global-layout') { $silvermountain_post_layout = get_theme_mod('silvermountain_single_post_layout', $silvermountain_default['silvermountain_archive_layout']); } } if (isset($post->ID)) { $silvermountain_page_layout = esc_html(get_post_meta($post->ID, 'silvermountain_page_layout', true)); } if ($silvermountain_post_layout == 'layout-2' && is_singular('post')) { if (have_posts()) : while (have_posts()) : the_post(); $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $silvermountain_ed_feature_image = esc_html(get_post_meta(get_the_ID(), 'silvermountain_ed_feature_image', true)); ?>