• File: functions.php
  • Full Path: /home/slvgwrnz/public_html/.tmb/wp-includes/wp-content/themes/remigious/functions.php
  • Date Modified: 03/11/2023 2:34 PM
  • File size: 13.57 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?php
/**
 * Prinox functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Prinox
 */

 /**
  * Define Core FIle
  */
define( 'PRINOX_THEME_DRI', get_template_directory() );
define( 'PRINOX_THEME_URI', get_template_directory_uri() );
define( 'PRINOX_CSS_PATH', PRINOX_THEME_URI . '/assets/css' );
define( 'PRINOX_JS_PATH', PRINOX_THEME_URI . '/assets/js' );
define( 'PRINOX_ICON_PATH', PRINOX_THEME_URI . '/assets/fonts/fontawesome/css' );
define( 'PRINOX_IMG_PATH', PRINOX_THEME_URI . '/assets/images' );

/**
 * 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 prinox_setup() {
	/*
	* Make theme available for translation.
	* Translations can be filed in the /languages/ directory.
	* If you're building a theme based on Prinox, use a find and replace
	* to change 'prinox' to the name of your theme in all the template files.
	*/
	load_theme_textdomain( 'prinox', get_template_directory() . '/languages' );

	// Add default posts and comments RSS feed links to head.
	add_theme_support( 'automatic-feed-links' );
	remove_theme_support( 'widgets-block-editor' );
	/*
	* Let WordPress manage the document title.
	* By adding theme support, we declare that this theme does not use a
	* hard-coded <title> tag in the document head, and expect WordPress to
	* provide it for us.
	*/
	add_theme_support( 'title-tag' );
	add_theme_support( 'woocommerce' );
	add_theme_support( 'wc-product-gallery-lightbox' );
	add_theme_support( 'wc-product-gallery-slider' );

	//Custom Image Size
	add_image_size( 'prinox-img-size-1', 428 , 546, true );
	add_image_size( 'prinox-img-size-2', 571 , 520, true );
	add_image_size( 'prinox-img-size-3', 475 , 310, true );
	add_image_size( 'prinox-img-size-4', 423 , 543, true );
	add_image_size( 'prinox-img-size-5', 365 , 215, true );
	add_image_size( 'prinox-img-size-6', 992 , 538, true );
	add_image_size( 'prinox-img-size-7', 175 , 145, true );
	add_image_size( 'prinox-img-size-8', 420 , 280, true );
	add_image_size( 'prinox-img-size-9', 295 , 366, true );

	/*
	* Enable support for Post Thumbnails on posts and pages.
	*
	* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
	*/
	add_theme_support( 'post-thumbnails' );

	// This theme uses wp_nav_menu() in one location.
	register_nav_menus(
		array(
			'primary-menu' => esc_html__( 'Main Menu', 'prinox' ),
			'main_menu_two' => esc_html__( 'Main Menu Two(This menu Display Only Header Four)', 'prinox' ),
			'category_menu' => esc_html__( 'Category Menu(This Menu Display Only Header Five)', 'prinox' ),
		)
	);

	/*
	* 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',
			'style',
			'script',
		)
	);

	// Set up the WordPress core custom background feature.
	add_theme_support(
		'custom-background',
		apply_filters(
			'prinox_custom_background_args',
			array(
				'default-color' => 'ffffff',
				'default-image' => '',
			)
		)
	);

	// Add theme support for selective refresh for widgets.
	add_theme_support( 'customize-selective-refresh-widgets' );

	/**
	 * Add support for core custom logo.
	 *
	 * @link https://codex.wordpress.org/Theme_Logo
	 */
	add_theme_support(
		'custom-logo',
		array(
			'height'      => 250,
			'width'       => 250,
			'flex-width'  => true,
			'flex-height' => true,
		)
	);
}
add_action( 'after_setup_theme', 'prinox_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 prinox_content_width() {
	$GLOBALS['content_width'] = apply_filters( 'prinox_content_width', 640 );
}
add_action( 'after_setup_theme', 'prinox_content_width', 0 );

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function prinox_widgets_init() {
	register_sidebar(
		array(
			'name'          => esc_html__( 'Sidebar', 'prinox' ),
			'id'            => 'sidebar-1',
			'description'   => esc_html__( 'Add widgets here.', 'prinox' ),
			'before_widget' => '<div id="%1$s" class="widget sidebar-widget-two %2$s"><div class="widget-content">',
			'after_widget'  => '</div></div>',
			'before_title'  => '<h4 class="widget-title">',
			'after_title'   => '</h4>',
		)
	);
	register_sidebar(
		array(
			'name'          => esc_html__( 'Footer One', 'prinox' ),
			'id'            => 'footer-1',
			'description'   => esc_html__( 'Add Footer WIdget here.', 'prinox' ),
			'before_widget' => '<div id="%1$s" class="%2$s">',
			'after_widget'  => '</div>',
			'before_title'  => '<h5>',
			'after_title'   => '</h5>',
		)
	);
	register_sidebar(
		array(
			'name'          => esc_html__( 'Footer Two', 'prinox' ),
			'id'            => 'footer-2',
			'description'   => esc_html__( 'Add Footer WIdget here.', 'prinox' ),
			'before_widget' => '<div id="%1$s" class="footer-widget links-widget %2$s"><div class="page-list">',
			'after_widget'  => '</div></div>',
			'before_title'  => '<h5>',
			'after_title'   => '</h5>',
		)
	);
	register_sidebar(
		array(
			'name'          => esc_html__( 'Footer Three', 'prinox' ),
			'id'            => 'footer-3',
			'description'   => esc_html__( 'Add Footer WIdget here.', 'prinox' ),
			'before_widget' => '<div id="%1$s" class="footer-widget links-widget %2$s"><div class="page-list">',
			'after_widget'  => '</div></div>',
			'before_title'  => '<h5>',
			'after_title'   => '</h5>',
		)
	);
	register_sidebar(
		array(
			'name'          => esc_html__( 'Footer Four', 'prinox' ),
			'id'            => 'footer-4',
			'description'   => esc_html__( 'Add Footer WIdget here.', 'prinox' ),
			'before_widget' => '<div id="%1$s" class="footer-widget news-widget %2$s">',
			'after_widget'  => '</div>',
			'before_title'  => '<h5>',
			'after_title'   => '</h5>',
		)
	);
	register_sidebar(
		array(
			'name'          => esc_html__( 'Sidebar Nav', 'prinox' ),
			'id'            => 'sidebar-widget-3',
			'description'   => esc_html__( 'Add Sidebar Nave here.', 'prinox' ),
			'before_widget' => '<div id="%1$s" class="sidebar-services-list">',
			'after_widget'  => '</div>',
			'before_title'  => '<h6>',
			'after_title'   => '</h6>',
		)
	);
}
add_action( 'widgets_init', 'prinox_widgets_init' );


/**
 *Google Font Load 
 */
if ( ! function_exists( 'prinox_fonts_url' ) ) :
/**
 * Register Google fonts for Blessing.
 */
function prinox_fonts_url() {
	$fonts_url     = '';
	$font_families = array();
	$subsets       = 'latin';


	if ( 'off' !== _x( 'on', 'Outfit: on or off', 'prinox' ) ) {
		$font_families[] = 'Outfit:100,200,300,400,500,600,700,800,900,';
	}

	if ( 'off' !== _x( 'on', 'Montaga: on or off', 'prinox' ) ) {
		$font_families[] = 'Montaga:400';
	}

	if ( 'off' !== _x( 'on', 'Inter: on or off', 'prinox' ) ) {
		$font_families[] = 'Inter:100,200,300,400,500,600,700,800,900,';
	}

	if ( 'off' !== _x( 'on', 'Poppins: on or off', 'prinox' ) ) {
		$font_families[] = 'Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i';
	}
	if ( 'off' !== _x( 'on', 'Jost: on or off', 'prinox' ) ) {
		$font_families[] = 'Jost:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i';
	}
	

	if ( $font_families ) {
		$fonts_url = add_query_arg( array(
			'family' => urlencode( implode( '|', $font_families ) ),
			'subset' => urlencode( $subsets ),
		), 'https://fonts.googleapis.com/css' );
	}

	return esc_url_raw( $fonts_url );
}
endif;

/**
 * Enqueue scripts and styles.
 */
function prinox_scripts() {

	//Prinox Google Font Load
	wp_enqueue_style( 'prinox-google-fonts', prinox_fonts_url(), array(), null );

	//Prinox Stylesheet Load
	wp_enqueue_style( 'bootstrap', PRINOX_CSS_PATH . '/bootstrap.css' );
	wp_enqueue_style( 'jquery-bootstrap-touchspin', PRINOX_CSS_PATH . '/jquery.bootstrap-touchspin.css' );
	wp_enqueue_style( 'jquery-mCustomScrollbar', PRINOX_CSS_PATH . '/jquery.mCustomScrollbar.min.css' );
	wp_enqueue_style( 'odometer-theme', PRINOX_CSS_PATH . '/odometer-theme-default.css' );
	wp_enqueue_style( 'prinox-global', PRINOX_CSS_PATH . '/global.css' );
	wp_enqueue_style( 'font-awesome-all', PRINOX_CSS_PATH . '/font-awesome.css' );
	wp_enqueue_style( 'prinox-flaticon', PRINOX_CSS_PATH . '/flaticon.css' );
	wp_enqueue_style( 'prinox-flaticon2', PRINOX_CSS_PATH . '/flaticon2.css' );
	wp_enqueue_style( 'prinox-animate', PRINOX_CSS_PATH . '/animate.css' );
	wp_enqueue_style( 'owl', PRINOX_CSS_PATH . '/owl.css' );
	wp_enqueue_style( 'linearicons', PRINOX_CSS_PATH . '/linearicons.css' );
	wp_enqueue_style( 'prinox-preloader', PRINOX_CSS_PATH . '/preloader.css' );
	wp_enqueue_style( 'custom-animate', PRINOX_CSS_PATH . '/custom-animate.css' );
	wp_enqueue_style( 'swiper', PRINOX_CSS_PATH . '/swiper.css' );
	wp_enqueue_style( 'magnific-popup', PRINOX_CSS_PATH . '/magnific-popup.css' );
	wp_enqueue_style( 'prinox-header', PRINOX_CSS_PATH . '/header.css' );
	wp_enqueue_style( 'countdown', PRINOX_CSS_PATH . '/countdown.css' );
	wp_enqueue_style( 'prinox-footer', PRINOX_CSS_PATH . '/footer.css' );
	wp_enqueue_style( 'select-style', PRINOX_CSS_PATH . '/select-style.css' );
	wp_enqueue_style( 'prinox-post-style', PRINOX_CSS_PATH . '/post-style.css' );
	wp_enqueue_style( 'prinox-main', PRINOX_CSS_PATH . '/style.css' );
	wp_enqueue_style( 'prinox-woocommerce', PRINOX_CSS_PATH . '/woocommerce.css' );
	wp_enqueue_style( 'prinox-responsive', PRINOX_CSS_PATH . '/responsive.css' );
	wp_enqueue_style( 'prinox-style', get_stylesheet_uri(), array(), '1.0' );
	if (is_rtl()) {		
		wp_enqueue_style( 'prinox-rtl', PRINOX_CSS_PATH . '/rtl.css' );
	}
	
	//Magezix Scripts Load
	wp_enqueue_script('masonry');
	wp_enqueue_script('jquery-ui-core');
	wp_enqueue_script('jquery-ui-selectmenu');
	wp_enqueue_script( 'popper', PRINOX_JS_PATH . '/popper.min.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'bootstrap', PRINOX_JS_PATH . '/bootstrap.min.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'magnific-popup', PRINOX_JS_PATH . '/magnific-popup.min.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'jquery-countdown', PRINOX_JS_PATH . '/jquery.countdown.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'prinox-appear', PRINOX_JS_PATH . '/appear.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'prinox-parallax', PRINOX_JS_PATH . '/parallax.min.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'jquery-marquee', PRINOX_JS_PATH . '/jquery.marquee.min.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'jquery-tilt', PRINOX_JS_PATH . '/tilt.jquery.min.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'jquery-paroller', PRINOX_JS_PATH . '/jquery.paroller.min.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'swiper', PRINOX_JS_PATH . '/swiper.min.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'tweenmax', PRINOX_JS_PATH . '/TweenMax.min.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'owl', PRINOX_JS_PATH . '/owl.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'wow', PRINOX_JS_PATH . '/wow.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'isotope', PRINOX_JS_PATH . '/isotope.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'odometer', PRINOX_JS_PATH . '/odometer.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'countdown', PRINOX_JS_PATH . '/countdown.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'mixitup', PRINOX_JS_PATH . '/mixitup.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'backToTop', PRINOX_JS_PATH . '/backToTop.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'nav-tool', PRINOX_JS_PATH . '/nav-tool.js', array('jquery'), '1.0', true );
	wp_enqueue_script( 'prinox-script', PRINOX_JS_PATH . '/script.js', array('jquery'), '1.0', true );

	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}
}
add_action( 'wp_enqueue_scripts', 'prinox_scripts' );

/**
 * Implement the Custom Header feature.
 */
require PRINOX_THEME_DRI . '/inc/custom-header.php';

/**
 * Custom template tags for this theme.
 */
require PRINOX_THEME_DRI . '/inc/template-tags.php';

/**
 * Functions which enhance the theme by hooking into WordPress.
 */
require PRINOX_THEME_DRI . '/inc/template-functions.php';

/**
 * Customizer additions.
 */
require PRINOX_THEME_DRI . '/inc/customizer.php';

/**
 * Prinox Theme Custom Function.
 */
require PRINOX_THEME_DRI . '/inc/prinox-functions.php';

/**
 * Prinox Options Function.
 */
require PRINOX_THEME_DRI . '/inc/cs-framework-functions.php';

/**
 * Prinox Required Plugin Activation Function.
 */
require PRINOX_THEME_DRI . '/lib/plugin-activation.php';

/**
 * Nav Walker
 */
require PRINOX_THEME_DRI . '/inc/class-wp-prinox-navwalker.php';

/**
 * Demo Import
 */
require PRINOX_THEME_DRI . '/lib/ocdi/functions.php';

/**
 * Custom Style
 */
require PRINOX_THEME_DRI . '/inc/custom-style.php';

/**
 * Load Jetpack compatibility file.
 */
if ( defined( 'JETPACK__VERSION' ) ) {
	require PRINOX_THEME_DRI . '/inc/jetpack.php';
}


function prinox_woo_theme_init(){
	$prinox_exlude_hooks = require PRINOX_THEME_DRI . '/inc/remove_actions.php';
	foreach( $prinox_exlude_hooks as $k => $v )
	{
		foreach( $v as $value )
		remove_action( $k, $value[0], $value[1] );
	}

}
add_action( 'init', 'prinox_woo_theme_init');


function prinox_megamenu_enable() {
	return true;
}
add_filter( 'th_enable_megamenu', 'prinox_megamenu_enable' );