File "functions-20241224123602.php"
Full Path: /home/flipjqml/onlinebetsolution.com/wp-content/themes/cyarb/functions-20241224123602.php
File size: 9.47 KB
MIME-type: text/x-php
Charset: utf-8
<?php
/**
* cyarb functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package cyarb
*/
define('CYARB_VERSION', time());
define('CYARB_THEME_DIR', get_template_directory());
if( !defined('CYARB_FRAMEWORK_VAR') ) define('CYARB_FRAMEWORK_VAR', 'cyarb_opt');
if ( ! function_exists( 'cyarb_setup' ) ) :
function cyarb_setup() {
// Make theme available for translation.
load_theme_textdomain( 'cyarb', 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.
add_theme_support( 'title-tag' );
// Enable support for post thumbnails on posts and pages.
add_theme_support( 'post-thumbnails' );
// Custom thumbnail image sizes
add_image_size( 'cyarb_standard_card_two', 860, 648, true );
add_image_size( 'cyarb_default_thumb', 860, 648, true );
add_image_size( 'cyarb_case_thumb', 860, 574, true );
add_image_size( 'cyarb_product_card', 670, 800, true );
/*
* 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 for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
// Add support for core custom logo
add_theme_support( 'custom-logo', array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
) );
// WooCommerce support
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
remove_theme_support( 'widgets-block-editor' );
}
endif;
add_action( 'after_setup_theme', 'cyarb_setup' );
// set the content width in pixels, based on the theme's design and stylesheet.
if ( ! function_exists( 'cyarb_content_width' ) ) :
function cyarb_content_width() {
$GLOBALS['content_width'] = apply_filters( 'cyarb_content_width', 640 );
}
endif;
add_action( 'after_setup_theme', 'cyarb_content_width', 0 );
// Enqueue scripts and styles.
if ( ! function_exists( 'cyarb_scripts' ) ) :
function cyarb_scripts() {
wp_enqueue_style( 'cyarb-style', get_stylesheet_uri() );
wp_style_add_data( 'cyarb-style', 'rtl', 'replace' );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', null, CYARB_VERSION );
wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/assets/css/fontawesome.min.css', null, CYARB_VERSION);
wp_enqueue_style( 'owl-carousel', get_template_directory_uri() . '/assets/css/owl.carousel.min.css', null, CYARB_VERSION);
wp_enqueue_style( 'owl-theme-default', get_template_directory_uri() . '/assets/css/owl.theme.default.min.css', null, CYARB_VERSION);
wp_enqueue_style( 'magnific-popup', get_template_directory_uri() . '/assets/css/magnific-popup.min.css', null, CYARB_VERSION);
wp_enqueue_style( 'animate', get_template_directory_uri() . '/assets/css/animate.min.css', null, CYARB_VERSION);
wp_enqueue_style( 'odometer', get_template_directory_uri() . '/assets/css/odometer.min.css', null, CYARB_VERSION);
wp_enqueue_style( 'lineicons', get_template_directory_uri() . '/assets/css/lineicons.css', null, CYARB_VERSION);
wp_enqueue_style( 'countryselect', get_template_directory_uri() . '/assets/css/countrySelect.min.css', null, CYARB_VERSION);
wp_enqueue_style( 'meanmenu', get_template_directory_uri() . '/assets/css/meanmenu.min.css', null, CYARB_VERSION);
wp_enqueue_style( 'slick', get_template_directory_uri() . '/assets/css/slick.min.css', null, CYARB_VERSION );
if( cyarb_rtl() == true ):
// WooCommerce CSS
if ( class_exists( 'WooCommerce' ) ):
wp_enqueue_style( 'cyarb-woocommerce', get_template_directory_uri() . '/assets/css/rtl/rtl-woocommerce.css', null, CYARB_VERSION );
endif;
wp_enqueue_style( 'cyarb-header-style', get_template_directory_uri() . '/assets/css/rtl/rtl-header.css', null, CYARB_VERSION);
wp_enqueue_style( 'cyarb-footer-style', get_template_directory_uri() . '/assets/css/rtl/rtl-footer.css', null, CYARB_VERSION);
wp_enqueue_style( 'cyarb-main-style', get_template_directory_uri() . '/assets/css/rtl/rtl-style.css', null, CYARB_VERSION);
wp_enqueue_style( 'cyarb-responsive', get_template_directory_uri() . '/assets/css/rtl/rtl-responsive.css', null, CYARB_VERSION);
else:
// WooCommerce CSS
if ( class_exists( 'WooCommerce' ) ):
wp_enqueue_style( 'cyarb-woocommerce', get_template_directory_uri() . '/assets/css/woocommerce.css', null, CYARB_VERSION );
endif;
wp_enqueue_style( 'cyarb-header-style', get_template_directory_uri() . '/assets/css/header.css', null, CYARB_VERSION);
wp_enqueue_style( 'cyarb-footer-style', get_template_directory_uri() . '/assets/css/footer.css', null, CYARB_VERSION);
wp_enqueue_style( 'cyarb-main-style', get_template_directory_uri() . '/assets/css/style.css', null, CYARB_VERSION);
wp_enqueue_style( 'cyarb-responsive', get_template_directory_uri() . '/assets/css/responsive.css', null, CYARB_VERSION);
endif;
// RTL CSS
if( cyarb_rtl() == true ):
wp_enqueue_style( 'cyarb-rtl', get_template_directory_uri() . '/style-rtl.css' );
endif;
/**
* Enqueueing JavaScript Files
*/
wp_enqueue_script( 'bootstrap-bundle', get_template_directory_uri() . '/assets/js/bootstrap.bundle.min.js', array ( 'jquery' ), CYARB_VERSION);
wp_enqueue_script( 'magnific-popup', get_template_directory_uri() . '/assets/js/magnific-popup.min.js', array ( 'jquery' ), CYARB_VERSION);
wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/assets/js/owl.carousel.min.js', array ( 'jquery' ), CYARB_VERSION);
wp_enqueue_script( 'owl-thumbs', get_template_directory_uri() . '/assets/js/owl.thumbs.min.js', array ( 'jquery' ), CYARB_VERSION);
wp_enqueue_script( 'countryselect', get_template_directory_uri() . '/assets/js/countrySelect.min.js', array ( 'jquery' ), CYARB_VERSION);
wp_enqueue_script( 'ajaxchimp', get_template_directory_uri() . '/assets/js/ajaxchimp.min.js', array ( 'jquery' ), CYARB_VERSION );
wp_enqueue_script( 'tweenmax', get_template_directory_uri() . '/assets/js/TweenMax.min.js', array ( 'jquery' ), CYARB_VERSION);
wp_enqueue_script( 'appear', get_template_directory_uri() . '/assets/js/appear.min.js', array ( 'jquery' ), CYARB_VERSION);
wp_enqueue_script( 'odometer', get_template_directory_uri() . '/assets/js/odometer.min.js', array ( 'jquery' ), CYARB_VERSION);
wp_enqueue_script( 'meanmenu', get_template_directory_uri() . '/assets/js/meanmenu.min.js', array ( 'jquery' ), CYARB_VERSION);
wp_enqueue_script( 'slick', get_template_directory_uri() . '/assets/js/slick.min.js', array('jquery'), CYARB_VERSION );
wp_enqueue_script( 'parallax', get_template_directory_uri() . '/assets/js/parallax.min.js', array('jquery'), CYARB_VERSION );
wp_enqueue_script( 'cyarb-main', get_template_directory_uri() . '/assets/js/main.js', array ( 'jquery' ), CYARB_VERSION);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
endif;
add_action( 'wp_enqueue_scripts', 'cyarb_scripts' );
// Load google fonts
if ( ! function_exists( 'cyarb_fonts' ) ) {
function cyarb_fonts() {
wp_enqueue_style( 'cyarb-fonts', "//fonts.googleapis.com/css?family=Jost:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;0,400;1,500;1,600;1,700;1,800;1,900;1&display=swap|Roboto:ital,wght@0,400;0,500;0,600;0,700;0,900;1,400;1,500;1,600;1,700;1,900;1&display=swap", '', '1.0.0', 'screen' );
}
}
add_action( 'wp_enqueue_scripts', 'cyarb_fonts' );
// Implement the Custom Header feature.
require get_template_directory() . '/inc/custom-header.php';
// Custom template tags for this theme.
require get_template_directory() . '/inc/template-tags.php';
// Functions which enhance the theme by hooking into WordPress.
require get_template_directory() . '/inc/template-functions.php';
// Customizer additions.
require get_template_directory() . '/inc/customizer.php';
// Theme widgets
require get_template_directory() . '/inc/widget.php';
// Custom style
require get_template_directory() . '/inc/custom-style.php';
// ACF
require get_template_directory() . '/inc/acf.php';
// Bootstrap navwalker
require get_template_directory() . '/inc/bootstrap-navwalker.php';
// Social link
require get_template_directory() . '/inc/social-link.php';
// TGM
require_once get_template_directory() . '/lib/class-tgm-plugin-activation.php';
// Recommended plugin
require_once get_template_directory() . '/lib/recommended-plugin.php';
// Load WooCommerce compatibility file.
if ( class_exists( 'WooCommerce' ) ) {
require get_template_directory() . '/inc/woocommerce.php';
}
/**
* Admin dashboard style and scripts
*/
add_action( 'admin_enqueue_scripts', function() {
global $pagenow;
wp_enqueue_script( 'cyarb-admin', get_template_directory_uri() . '/assets/js/cyarb-admin.js', array('jquery'), '1.0.0', true );
if ( $pagenow == 'admin.php' ) {
wp_enqueue_style( 'cyarb-admin-dashboard', get_template_directory_uri() . '/assets/css/admin-dashboard.min.css' );
}
});
/**
* Notice dismiss handle
*/
add_action( 'admin_init', function() {
if ( isset($_GET['dismissed']) && $_GET['dismissed'] == 1 ) {
update_option('notice_dismissed', '1');
}
});