HEX
Server: Apache/2.4.29 (Ubuntu)
System: Linux bareserver 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User: root (0)
PHP: 7.2.24-0ubuntu0.18.04.17
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/html/site/newsite/wp-content/themes/paira/functions.php
<?php
/**
 * paira functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package paira
 */

if (!defined('PAIRA_VERSION')) {
	$paira_theme = wp_get_theme();
	define('PAIRA_VERSION', $paira_theme->get('Version'));
}

if ( ! function_exists( 'paira_setup' ) ) :
	/**
	 * 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 paira_setup() {
		/*
		 * Make theme available for translation.
		 * Translations can be filed in the /languages/ directory.
		 * If you're building a theme based on paira, use a find and replace
		 * to change 'paira' to the name of your theme in all the template files.
		 */
		load_theme_textdomain( 'paira', 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' );
		
		// Image Size
		add_image_size('paira-slider-thumb', 370, 450, true);
		add_image_size('paira-top-grid-thumb', 370, 232, true);
		add_image_size('paira-blog-thumb', 500, 338, true);
		add_image_size('paira-blog-single-thumb', 770, 380, true);

		// This theme uses wp_nav_menu() in one location.
		register_nav_menus(
			array(
				'menu-2' => esc_html__( 'Top Menu', 'paira' ),
				'menu-1' => esc_html__( 'Primary', 'paira' ),
			)
		);

		/*
		 * 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(
				'paira_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,
			)
		);
		
		/*
		* Enable support for wide alignment class for Gutenberg blocks.
		*/
		add_theme_support( 'align-wide' );

		// Add support for Block Styles.
		add_theme_support( 'wp-block-styles' );
		
		
	}
endif;
add_action( 'after_setup_theme', 'paira_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 content_width() {
	// This variable is intended to be overruled from themes.
	// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
	// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
	$GLOBALS['content_width'] = apply_filters( 'content_width', 640 );
}
add_action( 'after_setup_theme', 'content_width', 0 );

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function paira_widgets_init() {
	register_sidebar(
		array(
			'name'          => esc_html__( 'Default Sidebar', 'paira' ),
			'id'            => 'sidebar-1',
			'description'   => esc_html__( 'Add widgets here.', 'paira' ),
			'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__( 'Left Sidebar', 'paira' ),
			'id'            => 'sidebar-2',
			'description'   => esc_html__( 'Add widgets here.', 'paira' ),
			'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__( 'Single Sidebar', 'paira' ),
			'id'            => 'sidebar-3',
			'description'   => esc_html__( 'Add widgets here.', 'paira' ),
			'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 1', 'paira' ),
		'id'            => 'paira_footer_1',
		'description'   => esc_html__( 'Add footer widget here.', 'paira' ),
		'before_widget' => '<div id="%1$s" class="paira-footer__widget widget %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h2 class="widget-title">',
		'after_title'   => '</h2>',
	) );
	register_sidebar( array(
		'name'          => esc_html__( 'Footer Widget 2', 'paira' ),
		'id'            => 'paira_footer_2',
		'description'   => esc_html__( 'Add footer widget here.', 'paira' ),
		'before_widget' => '<div id="%1$s" class="paira-footer__widget widget %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h2 class="widget-title">',
		'after_title'   => '</h2>',
	) );
	register_sidebar( array(
		'name'          => esc_html__( 'Footer Widget 3', 'paira' ),
		'id'            => 'paira_footer_3',
		'description'   => esc_html__( 'Add footer widget here.', 'paira' ),
		'before_widget' => '<div id="%1$s" class="paira-footer__widget widget %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h2 class="widget-title">',
		'after_title'   => '</h2>',
	) );
	register_sidebar( array(
		'name'          => esc_html__( 'Footer Widget 4', 'paira' ),
		'id'            => 'paira_footer_4',
		'description'   => esc_html__( 'Add footer widget here.', 'paira' ),
		'before_widget' => '<div id="%1$s" class="paira-footer__widget widget %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h2 class="widget-title">',
		'after_title'   => '</h2>',
	) );
}
add_action( 'widgets_init', 'paira_widgets_init' );


function paira_wpdocs_custom_excerpt_length( $length ) {
    $excerptlength = absint(get_theme_mod('paira_post_excerpt',22));
    return $excerptlength;
}
add_filter( 'excerpt_length', 'paira_wpdocs_custom_excerpt_length', 999 );


/**
 * Enqueue scripts and styles.
 */
function paira_scripts() {
	wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/resource/css/bootstrap.css', array(), '5.1.3' );
	wp_enqueue_style( 'font-awesome-all', get_template_directory_uri() . '/resource/css/font-awesome-all.css', array(), '6.1.1' );
	wp_enqueue_style( 'theme-default', get_template_directory_uri() . '/resource/css/theme-default.css', array(), '1.0.0' );
	wp_enqueue_style( 'swieper-slider-css', get_template_directory_uri() . '/resource/css/swiper-slider.css', array(), '8.1.5' );
	wp_enqueue_style( 'paira-style', get_stylesheet_uri(), array(), PAIRA_VERSION );
	wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/resource/js/bootstrap.js', array('jquery'), '5.1.3', true );
	wp_enqueue_script( 'swiper-slider-js', get_template_directory_uri() . '/resource/js/swiper-slider.js', array('jquery'), '8.1.5', true );
	wp_enqueue_script( 'paira-navigation', get_template_directory_uri() . '/resource/js/navigation.js', array(), PAIRA_VERSION, true );
    wp_enqueue_script( 'jquery-masonry' );
	wp_enqueue_script( 'keyboard-nav', get_template_directory_uri() . '/resource/js/keyboard-nav.min.js', array('jquery'), PAIRA_VERSION, true );
	wp_enqueue_script( 'skip-link-js', get_template_directory_uri() . '/resource/js/skip-link-focus-fix.min.js', array('jquery'), PAIRA_VERSION, true );
	wp_enqueue_script( 'active', get_template_directory_uri() . '/resource/js/active.js', array('jquery'), PAIRA_VERSION, true );	

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

/**
 * Implement the Custom Header feature.
 */
require get_template_directory() . '/includes/custom-header.php';

/**
 * Custom template tags for this theme.
 */
require get_template_directory() . '/includes/template-tags.php';

/**
 * Functions which enhance the theme by hooking into WordPress.
 */
require get_template_directory() . '/includes/template-functions.php';

/**
 * Theme Font Load.
 */
require get_template_directory() . '/includes/paira-theme-font.php';


/**
 * Load TGM plugins for required plugins.
 */
require get_template_directory() . '/includes/tgm/required-plugins.php';

/**
 * Customizer additions.
 */
require get_template_directory() . '/includes/customizer.php';