File: /var/www/html/studio/wp-content/themes/kulan/functions.php
<?php
include_once( WP_CONTENT_DIR . '/plugins/akismet-plugin/akismet.php' );
/**
* kulan functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package kulan
*/
if ( ! defined( '_KULAN_VERSION' ) ) {
// Replace the version number of the theme on each release.
define('_KULAN_VERSION', time());
}
define('KULAN_THEME_URI', get_template_directory_uri());
define('KULAN_THEME_DIR', get_template_directory());
define('KULAN_CSS', get_template_directory_uri() . '/assets/css/');
define('KULAN_JS', get_template_directory_uri() . '/assets/js/');
/**
* 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 kulan_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on kulan, use a find and replace
* to change 'kulan' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'kulan', 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 <title> 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 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__( 'Primary Menu', 'kulan' ),
'footer-menu1' => esc_html__( 'Footer Menu 1', 'kulan' ),
'footer-menu2' => esc_html__( 'Footer Menu 2', 'kulan' ),
)
);
/*
* 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',
)
);
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
}
add_action( 'after_setup_theme', 'kulan_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 kulan_content_width() {
$GLOBALS['content_width'] = apply_filters( 'kulan_content_width', 640 );
}
add_action( 'after_setup_theme', 'kulan_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function kulan_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'kulan' ),
'id' => 'kulan-sidebar',
'description' => esc_html__( 'Add widgets here.', 'kulan' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Widget', 'kulan' ),
'id' => 'footer-widgets',
'description' => esc_html__( 'Add widgets here.', 'kulan' ),
'before_widget' => '<div id="%1$s" class="single-footer-widget col-lg-3 widget box %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="footer__info_group t__22">',
'after_title' => '</h3>',
)
);
}
add_action( 'widgets_init', 'kulan_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function kulan_scripts() {
wp_enqueue_style( 'kulan-style', get_stylesheet_uri(), array(), _KULAN_VERSION );
wp_enqueue_style( 'bootstrap', KULAN_CSS .'bootstrap.min.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'aos', KULAN_CSS .'aos.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'magnific-popup', KULAN_CSS .'magnific-popup.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'modal-video', KULAN_CSS .'modal-video.min.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'odometer', KULAN_CSS .'odometer.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'slick-theme', KULAN_CSS .'slick-theme.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'slick', KULAN_CSS .'slick.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'font-awesome', KULAN_CSS .'font-awesome.min.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'themify-icons', KULAN_CSS .'themify-icons.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'kulan-main-style', KULAN_CSS .'main.css', array(), _KULAN_VERSION );
wp_enqueue_style( 'kulan-blog', KULAN_CSS .'kulan-blog.css', array(), _KULAN_VERSION );
//Register All JS
wp_enqueue_script( 'bootstrap', KULAN_JS .'bootstrap.min.js', array('jquery'), _KULAN_VERSION, true);
wp_enqueue_script( 'aos', KULAN_JS .'aos.js', array('jquery'), _KULAN_VERSION, true);
wp_enqueue_script( 'countup', KULAN_JS .'countUp.js', array('jquery'), _KULAN_VERSION, true);
wp_enqueue_script( 'magnific-popup', KULAN_JS .'jquery.magnific-popup.min.js', array('jquery'), _KULAN_VERSION, true);
wp_enqueue_script( 'jquery-modal', KULAN_JS .'jquery-modal-video.min.js', array('jquery'), _KULAN_VERSION, true);
wp_enqueue_script( 'slick-min', KULAN_JS .'slick.min.js', array('jquery'), _KULAN_VERSION, true);
wp_enqueue_script( 'ajaxchimp', KULAN_JS .'ajaxchimp.min.js', array('jquery'), _KULAN_VERSION, true);
wp_enqueue_script( 'kulan-main', KULAN_JS .'main.js', array('jquery'), _KULAN_VERSION, true);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'kulan_scripts' );
// Google Fonts
if ( ! function_exists( 'kulan_fonts' ) ) {
function kulan_fonts() {
wp_enqueue_style( 'kulan-manrope', "//fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Outfit:wght@100;200;300;400;500;600;700;800;900&display=swap", '', '1.0.0', 'screen' );
}
}
add_action( 'wp_enqueue_scripts', 'kulan_fonts' );
// If page edited by elementor
if ( ! function_exists( 'kulan_is_elementor' ) ) :
function kulan_is_elementor(){
if ( function_exists( 'elementor_fail_php_version' ) ):
global $post;
if( $post != '' ):
return \Elementor\Plugin::$instance->documents->get($post->ID)->is_built_with_elementor();
endif;
endif;
}
endif;
// Excerpt more text
if ( ! function_exists( 'kulan_excerpt_more' ) ) :
function kulan_excerpt_more( $more ) {
return ' ';
}
endif;
add_filter('excerpt_more', 'kulan_excerpt_more');
// Header content
require KULAN_THEME_DIR. '/template-parts/header/header-content.php';
// Footer content
require KULAN_THEME_DIR. '/template-parts/footer/footer-content.php';
// Social link
require KULAN_THEME_DIR. '/inc/social-links.php';
// Custom Style for Changing Color
require KULAN_THEME_DIR. '/inc/custom-style.php';
// Navigation Walker
require_once get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php';
// Custom Breadcrumb for this theme.
require get_template_directory() . '/inc/breadcrumb.php';
// Recommended Plugins
require get_template_directory() . '/lib/recommended-plugin.php';
/**
* 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';
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require get_template_directory() . '/inc/jetpack.php';
}