File: /home/roshanchandy/public_html/dubai91.com/old/wp-content/themes/inclub/functions.php
<?php
/**
* Theme functions and definitions
*
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
define( 'INCLUB_THEME_VERSION', wp_get_theme()->get( 'Version' ) );
define( 'INCLUB_THEME_DIR', get_template_directory() );
define( 'INCLUB_THEME_URL', get_template_directory_uri() );
define( 'AWAIKEN_ITEM_ID', 8086 );
define( 'AWAIKEN_ITEM_NAME', 'Inclub' );
define( 'AWAIKEN_THEME_SLUG', 'inclub' );
define( 'AWAIKEN_MP', 'TF' );
if ( ! isset( $content_width ) ) {
$content_width = 800; // Pixels.
}
// Theme storage
// Attention! Must be in the global namespace to compatibility with WP-CLI
//-------------------------------------------------------------------------
$GLOBALS['INCLUB_STORAGE'] = array(
'social_sharing' => 'facebook,whatsapp,linkedin',
'social_urls' => 'https://www.instagram.com/ ,https://www.facebook.com/ ,https://www.youtube.com/',
'show_preloader' => 0,
'magic_cursor' => 1,
'show_small_heading_icon' => 1,
'small_heading_icon' => '',
'footer_copyright_text' => '',
'smooth_scrolling' => 0,
'archive_page_layout' => 'full-width',
'blog_single_page_layout' => 'full-width',
'preloader_icon' => '',
'project_page_title' => '',
'project_archive_page_layout' => 'full-width',
'project_single_page_layout' => 'full-width',
'project_page_header_background_image' => '',
'header_background_image' => '',
'blog_page_header_background_image' => '',
'404_image' => INCLUB_THEME_URL.'/assets/images/404-error-img.png',
'read_more_icon' => INCLUB_THEME_DIR.'/assets/images/arrow-primary.svg',
);
if ( ! function_exists( 'inclub_slug_fonts_url' ) ) {
function inclub_slug_fonts_url() {
$fonts_url = '';
/* Translators: If there are characters in your language that are not
* supported by Jost, translate this to 'off'. Do not translate
* into your own language.
*/
$font = _x( 'on', 'Jost font: on or off', 'inclub' );
if ( 'off' !== $font ) {
$font_families = array();
if ( 'off' !== $font ) {
$font_families[] = 'Jost:ital,wght@0,100..900;1,100..900';
}
$query_args = array(
'family' => implode( '&family=', $font_families ),
'display' => 'swap',
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css2' );
}
return esc_url_raw( $fonts_url );
}
}
if ( ! function_exists( 'inclub_theme_setup' ) ) {
/**
* Set up theme support.
*
* @return void
*/
function inclub_theme_setup() {
register_nav_menus(
array(
'header' => esc_html__( 'Header', 'inclub' ) ,
'footer' => esc_html__( 'Footer', 'inclub' )
)
);
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'editor-styles' );
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'script',
'style',
)
);
add_theme_support(
'custom-logo',
array(
'height' => 100,
'width' => 350,
'flex-height' => true,
'flex-width' => true,
)
);
/*
* Gutenberg wide images.
*/
add_theme_support( 'align-wide' );
/**
* Load textdomain.
*/
load_theme_textdomain( 'inclub', INCLUB_THEME_DIR . '/languages' );
if ( is_admin() ) {
add_editor_style( array( inclub_slug_fonts_url(), 'assets/css/css-variable.css', 'assets/css/all.min.css', 'style-editor.css' ) );
}
}
}
add_action( 'after_setup_theme', 'inclub_theme_setup' );
/**
* Enqueue styles
*/
if ( ! function_exists( 'inclub_theme_load_styles' ) ) {
function inclub_theme_load_styles() {
if( get_option( 'inclub_demo_imported' ) != 1 ) {
wp_enqueue_style( 'inclub-font-manrope', inclub_slug_fonts_url(), array(), null );
}
wp_enqueue_style( 'inclub-css-variable', INCLUB_THEME_URL . '/assets/css/css-variable.css', array(), INCLUB_THEME_VERSION );
wp_enqueue_style( 'fontawesome-6.4.0', INCLUB_THEME_URL . '/assets/css/all.min.css', array(), INCLUB_THEME_VERSION );
wp_enqueue_style( 'bootstrap-5.3.2', INCLUB_THEME_URL . '/assets/css/bootstrap.min.css', array(), INCLUB_THEME_VERSION );
wp_enqueue_style( 'inclub-style', INCLUB_THEME_URL . '/style.css', array('bootstrap-5.3.2','fontawesome-6.4.0'), INCLUB_THEME_VERSION );
}
}
add_action( 'wp_enqueue_scripts', 'inclub_theme_load_styles', 998 );
/**
* Enqueue scripts
*/
if ( ! function_exists( 'inclub_theme_load_scripts' ) ) {
function inclub_theme_load_scripts() {
global $INCLUB_STORAGE;
if( get_theme_mod( 'smooth_scrolling', $INCLUB_STORAGE['smooth_scrolling'] ) ) {
wp_enqueue_script( 'SmoothScroll', INCLUB_THEME_URL . '/assets/js/SmoothScroll.js', array( 'jquery' ), INCLUB_THEME_VERSION, true );
}
wp_enqueue_script( 'gsap', INCLUB_THEME_URL . '/assets/js/gsap.min.js', array( 'jquery' ), INCLUB_THEME_VERSION, true );
if( get_theme_mod( 'magic_cursor', $INCLUB_STORAGE['magic_cursor'] ) ) {
wp_enqueue_script( 'magiccursor', INCLUB_THEME_URL . '/assets/js/magiccursor.js', array( 'jquery' ), INCLUB_THEME_VERSION, true );
}
wp_enqueue_script( 'SplitText', INCLUB_THEME_URL . '/assets/js/SplitText.js', array( 'jquery' ), INCLUB_THEME_VERSION, true );
wp_enqueue_script( 'ScrollTrigger', INCLUB_THEME_URL . '/assets/js/ScrollTrigger.min.js', array( 'jquery' ), INCLUB_THEME_VERSION, true );
wp_enqueue_script( 'theme-js', INCLUB_THEME_URL . '/assets/js/function.js', array( 'jquery' ), INCLUB_THEME_VERSION, true );
// js for comments
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
}
add_action( 'wp_enqueue_scripts', 'inclub_theme_load_scripts' );
/**
* Register widget area.
*/
if ( ! function_exists( 'inclub_widgets_init' ) ) {
function inclub_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'inclub' ),
'id' => 'main-sidebar',
'description' => esc_html__( 'Add widgets here to appear in your sidebar.', 'inclub' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => esc_html__( 'Project Sidebar', 'inclub' ),
'id' => 'project-sidebar',
'description' => esc_html__( 'Add widgets here to appear in your project sidebar.', 'inclub' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
}
add_action( 'widgets_init', 'inclub_widgets_init' );
/**
* Change post per page for Project
*/
function inclub_pre_get_posts_project( $query ) {
if ( ! is_admin() && $query->is_main_query() && is_post_type_archive( 'awaiken-project' ) ) {
$query->set( 'posts_per_page', 999 );
return;
}
}
add_action( 'pre_get_posts', 'inclub_pre_get_posts_project', 11 );
/**
* Include required file
*/
require_once INCLUB_THEME_DIR . '/inc/init.php';