HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 PHP/7.4.33
System: Linux webkhoa.212 3.10.0-1160.59.1.el7.x86_64 #1 SMP Wed Feb 23 16:47:03 UTC 2022 x86_64
User: fect (1004)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/fect/web/fect.ictu.edu.vn/public_html/wp-content/themes/ictu/functions.php
<?php
/**
 * 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.
 */

if ( !defined( 'WCMP_UNLOAD_BOOTSTRAP_LIB' ) ) {
	define( 'WCMP_UNLOAD_BOOTSTRAP_LIB' , true );
}
// Theme version.
if ( !defined( 'THEME_VERSION' ) ) {
	define( 'THEME_VERSION' , wp_get_theme()->get( 'Version' ) );
}

if ( !function_exists( 'theme_init_setup' ) ) {
	function theme_init_setup ()
	{
		// Set the default content width.
		$GLOBALS['content_width'] = 1400;
		/*
		 * Make theme available for translation.
		 * Translations can be filed at WordPress.org. See: https://translate.wordpress.org/projects/wp-themes/blank
		 * If you're building a theme based on Twenty Seventeen, use a find and replace
		 * to change 'ictu' to the name of your theme in all the template files.
		 */
		load_theme_textdomain( 'ictu' , 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' );
		add_theme_support( 'custom-background' );
		/*
		 * 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' ,
			'widgets' ,
		) );
		// This theme uses wp_nav_menu() in two locations.
		register_nav_menus(
			array(
				'primary'              => __( 'Primary Menu' , 'ictu' ) ,
				'top-bar-left'         => __( 'Top bar left menu' , 'ictu' ) ,
				'top-bar-right'        => __( 'Top bar right menu' , 'ictu' ) ,
				'footer-center'        => __( 'Footer Top Center' , 'ictu' ) ,
				'footer-center-bottom' => __( 'Footer Bottom Center' , 'ictu' ) ,
				'footer-right'         => __( 'Footer Top Right' , 'ictu' ) ,
				'footer-right-bottom'  => __( 'Footer Bottom Right' , 'ictu' ) ,
			)
		);
		// Add theme support for selective refresh for widgets.
		add_theme_support( 'customize-selective-refresh-widgets' );

		/**
		 *
		 * SUPPORT BLOCKS
		 **/

		// 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_theme_support( 'dark-editor-style' );

		// Add support for responsive embedded content.
		add_theme_support( 'responsive-embeds' );
	}

	add_action( 'after_setup_theme' , 'theme_init_setup' );
}
/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
if ( !function_exists( 'theme_widgets_init' ) ) {
	function theme_widgets_init ()
	{
		$sidebars      = array(
			'widget-area'      => array(
				'name'          => esc_html__( 'Widget Area' , 'ictu' ) ,
				'id'            => 'widget-area' ,
				'description'   => esc_html__( 'Add widgets here to appear in your blog sidebar.' , 'ictu' ) ,
				'before_widget' => '<div id="%1$s" class="widget %2$s">' ,
				'after_widget'  => '</div>' ,
				'before_title'  => '<h2 class="widget-title">' ,
				'after_title'   => '<span class="arrow"></span></h2>' ,
			) ,
			'post-widget-area' => array(
				'name'          => esc_html__( 'Post Widget Area' , 'ictu' ) ,
				'id'            => 'post-widget-area' ,
				'description'   => esc_html__( 'Add widgets here to appear in your post sidebar.' , 'ictu' ) ,
				'before_widget' => '<div id="%1$s" class="widget %2$s">' ,
				'after_widget'  => '</div>' ,
				'before_title'  => '<h2 class="widget-title">' ,
				'after_title'   => '<span class="arrow"></span></h2>' ,
			)
		);
		$multi_sidebar = get_theme_option( 'multi_sidebar' );
		if ( is_array( $multi_sidebar ) && !empty( $multi_sidebar ) ) {
			foreach ( $multi_sidebar as $sidebar ) {
				if ( !empty( $sidebar ) ) {
					$sidebar_id            = 'custom-sidebar-' . sanitize_key( $sidebar['add_sidebar'] );
					$sidebars[$sidebar_id] = array(
						'name'          => $sidebar['add_sidebar'] ,
						'id'            => $sidebar_id ,
						'before_widget' => '<div id="%1$s" class="widget %2$s">' ,
						'after_widget'  => '</div>' ,
						'before_title'  => '<h2 class="widget-title">' ,
						'after_title'   => '<span class="arrow"></span></h2>' ,
					);
				}
			}
		}
		foreach ( $sidebars as $sidebar ) {
			register_sidebar( $sidebar );
		}
	}

	add_action( 'widgets_init' , 'theme_widgets_init' );
}
/**
 * Custom Comment field.
 */
if ( !function_exists( 'theme_comment_field_to_bottom' ) ) {
	function theme_comment_field_to_bottom ( $fields )
	{
		$comment_field = $fields['comment'];
		unset( $fields['comment'] );
		$fields['comment'] = $comment_field;

		return $fields;
	}

	//add_filter( 'comment_form_fields', 'theme_comment_field_to_bottom' );
}
/**
 * Custom Body Class.
 */
if ( !function_exists( 'theme_body_class' ) ) {
	function theme_body_class ( $classes )
	{
		$my_theme = wp_get_theme();
		if ( theme_is_mobile() ) {
			$classes[] = "enable-mobile-mode";
		}
		$classes[] = "ictu-v" . $my_theme->get( 'Version' );

		return $classes;
	}

	add_filter( 'body_class' , 'theme_body_class' );
}

if ( !function_exists( 'theme_check_hide_title' ) ) {
	/**
	 * Check hide title.
	 *
	 * @param bool $val default value.
	 *
	 * @return bool
	 */
	function theme_check_hide_title ( $val )
	{
		if ( defined( 'ELEMENTOR_VERSION' ) ) {
			$current_doc = \Elementor\Plugin::instance()->documents->get( get_the_ID() );
			if ( $current_doc && 'yes' === $current_doc->get_settings( 'hide_title' ) ) {
				$val = false;
			}
		}

		return $val;
	}
}
add_filter( 'theme_page_title' , 'theme_check_hide_title' );

/**
 * WordPress shims.
 */
if ( !function_exists( 'wp_body_open' ) ) {
	function wp_body_open ()
	{
		do_action( 'wp_body_open' );
	}
}
/**
 * Functions theme helper.
 */
require get_parent_theme_file_path( '/framework/settings/helpers.php' );
/**
 * Enqueue scripts and styles.
 */
require get_parent_theme_file_path( '/framework/settings/enqueue.php' );
/**
 * Functions add inline style inline.
 */
require get_parent_theme_file_path( '/framework/settings/color-patterns.php' );
/**
 * Functions plugin load.
 */
require get_parent_theme_file_path( '/framework/settings/plugins-load.php' );
/**
 * Functions theme AJAX.
 */
require get_parent_theme_file_path( '/framework/classes/core-ajax.php' );
/**
 * Functions theme breadcrumbs.
 */
require get_parent_theme_file_path( '/framework/classes/breadcrumbs.php' );
/**
 * Functions theme options.
 */
require get_parent_theme_file_path( '/framework/settings/theme-options.php' );
/**
 * Functions metabox options.
 */
require get_parent_theme_file_path( '/framework/settings/metabox-options.php' );
/**
 * Functions theme.
 */
require get_parent_theme_file_path( '/framework/theme-functions.php' );
/**
 * Functions blog.
 */
require get_parent_theme_file_path( '/framework/blog-functions.php' );

/**
 * Theme widgets
 */
require get_parent_theme_file_path( '/framework/widget-init.php' );

/**
 * Functions WooCommerce
 */
if ( class_exists( 'WooCommerce' ) ) {
	require get_parent_theme_file_path( '/framework/woo-functions.php' );
}

/**
 * Overwrite author capabilities
 */
require get_parent_theme_file_path( '/framework/author-capabilities.php' );

/**
 * Custom attachments fields
 */
require get_parent_theme_file_path( '/custom-attachments/custom-attachments.php' );