HEX
Server: Apache/2.2.34 (Unix) mod_fastcgi/mod_fastcgi-SNAP-0910052141
System: Linux Kou-Etsu-Dou 4.4.59+ #25556 SMP PREEMPT Thu Mar 4 18:03:46 CST 2021 x86_64
User: hosam (1026)
PHP: 7.2.29
Disabled: NONE
Upload Files
File: /volume1/web/wordpress/wp-content/themes/hansen/functions.php
<?php

if ( ! function_exists( 'hansen_support' ) ) {
	function hansen_support()  {

		// Make theme available for translation.
		load_theme_textdomain( 'hansen', get_template_directory() . '/languages' );

		// Add default posts and comments RSS feed links to head.
		add_theme_support( 'automatic-feed-links' );

		// Adding support for featured images.
		add_theme_support( 'post-thumbnails' );

		// Adding support for alignwide and alignfull classes in the block editor.
		add_theme_support( 'align-wide' );

		// Adding support for core block visual styles.
		add_theme_support( 'wp-block-styles' );

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

		// Add support for editor styles.
		add_theme_support( 'editor-styles' );

		// Enqueue editor styles.
		add_editor_style( array( 'style.css', hansen_fonts_url() ) );

    }
    add_action( 'after_setup_theme', 'hansen_support' );
}

/**
 * Enqueue scripts and styles.
 */
function hansen_scripts() {
	wp_enqueue_style( 'dashicons' );

	// Enqueue theme stylesheet.
	wp_enqueue_style( 'hansen-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );

	// Enqueue fonts stylesheet.
	wp_enqueue_style( 'hansen-fonts-style', hansen_fonts_url(), array(), wp_get_theme()->get( 'Version' ) );

	// Enqueue navigation script.
	wp_enqueue_script( 'hansen-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array( 'jquery' ), wp_get_theme()->get( 'Version' ), false );

	// Enqueue alignment script.
	wp_enqueue_script( 'hansen-alignment', get_template_directory_uri() . '/assets/js/alignment.js', array( 'jquery' ), wp_get_theme()->get( 'Version' ), false );

}
add_action( 'wp_enqueue_scripts', 'hansen_scripts' );

/**
 * Enqueue editor scripts and styles.
 * Required for Site Editor
 */
function hansen_editor_scripts() {
	// Enqueue theme stylesheet.
	wp_enqueue_style( 'hansen-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );

	// Enqueue fonts stylesheet.
	wp_enqueue_style( 'hansen-fonts-style', hansen_fonts_url(), array(), wp_get_theme()->get( 'Version' ) );
}
add_action( 'enqueue_block_editor_assets', 'hansen_editor_scripts' );

/**
 * Get Google fonts and save locally with WPTT Webfont Loader.
 */
function hansen_fonts_url() {
	$font_families = array(
		'Quicksand:wght@300;400;500;600;700',
		'Work+Sans:wght@300;400;500;600;700'
	);

	$fonts_url = add_query_arg( array(
		'family' => implode( '&family=', $font_families ),
		'display' => 'swap',
	), 'https://fonts.googleapis.com/css2' );

	require_once get_theme_file_path( 'inc/wptt-webfont-loader.php' );

	return wptt_get_webfont_url( esc_url_raw( $fonts_url ) );
}

/**
 * Skip link.
 */
function hansen_wp_body_open() {
	echo '<a class="skip-link screen-reader-text" href="#primary">' . esc_html__( 'Skip to content', 'hansen' ) . '</a>';
}
add_action( 'wp_body_open', 'hansen_wp_body_open' );

/**
 * Block patterns.
 */
if ( function_exists( 'register_block_pattern' ) ) {
	require get_template_directory() . '/inc/block-patterns.php';
}

/**
 * Block styles.
 */
if ( function_exists( 'register_block_style' ) ) {
	require get_template_directory() . '/inc/block-styles.php';
}

/**
 * Require Gutenberg plugin.
 * When full site editing is part of WP core, this can be removed.
 */
require get_template_directory() . '/inc/require-gutenberg.php';

/**
 * Single WooCommerce product.
 * Temporary solution to show how current product could display in single-product template.
 * Product archives work well, and can also build pages using WC blocks,
 * but without this shortcode, single product pages are empty.
 * Will be removed when WooCommerce supports Site Editing.
 */
function hansen_wc_product_shortcode() {
	global $post;
	$postID = $post->ID;
	return do_shortcode('[product_page id="'.$postID.'"]');
}
$shortcode_tags['hansen_wc_product'] = 'hansen_wc_product_shortcode';