HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/iskcon/public_html/wp-content/themes/tow-temple/functions.php_bak
<?php

/**
 * temple functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package tow-temple
 */

if ( ! defined( 'TOW' ) ) {
	// Replace the version number of the theme on each release.
	define( 'TOW', '1.0.1' );
}

/**
 * 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 tow_theme_setup() {

    	/*
		* 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(
			'menu-1' => esc_html__( 'Primary', 'tow' ),
		)
	);


	   /*
		* 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(
			'tow_theme_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,
		)
	);

    add_image_size( 'tow-250x250', 250, 250, true ); // volunteers home page
    add_image_size( 'tow-360x240', 360, 240, true ); // post footer bottom
	add_image_size( 'tow-750x500', 750, 500, true ); // post header bg
	add_image_size( 'tow-1920x1000', 1920, 1000, true ); // post header bg
}
add_action( 'after_setup_theme', 'tow_theme_setup' );

function allow_svg_and_ico_upload( $mimes ) {
     // Allow .ICO files with both MIME types
    $mimes['ico'] = 'image/x-icon';  // Most common MIME type
    $mimes['ico'] = 'image/vnd.microsoft.icon';  // Alternative MIME type
    return $mimes;
}
add_filter( 'upload_mimes', 'allow_svg_and_ico_upload' );

/**
 * Register widget area.
 */

function tow_theme_widgets_init() {

   	register_sidebar(    
		array(
			'name'          => esc_html__( 'Footer Top Section 1', 'tow' ),
			'id'            => 'footer-section-1',
			'description'   => esc_html__( 'Add widgets here.', 'tow' ),
			'before_widget' => '',
			'after_widget'  => '',
			'before_title'  => '<h4 class="text-white mb-4">',
			'after_title'   => '</h4>',
		)
	);

	register_sidebar(
		array(
			'name'          => esc_html__( 'Footer Top Section 4', 'tow' ),
			'id'            => 'footer-section-4',
			'description'   => esc_html__( 'Add widgets here.', 'tow' ),
			'before_widget' => '',
			'after_widget'  => '',
			'before_title'  => '<h4 class="text-white mb-4">',
			'after_title'   => '</h4>',
		)
	);

  register_sidebar(
		array(
			'name'          => esc_html__( 'Post Sidebar', 'tow' ),
			'id'            => 'post-sidebar',
			'description'   => esc_html__( 'Add widgets here.', 'tow' ),
			'before_widget' => '<div class="blog_pg1r1 border_1 p-4 mb-4">',
			'after_widget'  => '</div>',
			'before_title'  => '<h4 class="head_1 mb-4">',
			'after_title'   => '</h4>',
		)
	);

  register_sidebar(
		array(
			'name'          => esc_html__( 'Event Sidebar', 'tow' ),
			'id'            => 'event-sidebar',
			'description'   => esc_html__( 'Add widgets here.', 'tow' ),
			'before_widget' => '<div class="blog_pg1r1 border_1 p-4 mb-4">',
			'after_widget'  => '</div>',
			'before_title'  => '<h4 class="head_1 mb-4">',
			'after_title'   => '</h4>',
		)
	);   
}

add_action( 'widgets_init', 'tow_theme_widgets_init' );




// 1. Load the Theme CSS

function tow_styles()
 {

    wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css' );
    wp_enqueue_style( 'tow-poppins', 'https://fonts.googleapis.com/css2?family=Poppins&display=swap' );
    wp_enqueue_style( 'tow-google-fonts', 'https://fonts.googleapis.com/css2?family=Sora:wght@100..800&display=swap' );

    wp_enqueue_style( 'tow-style-fontawesome', get_template_directory_uri() . '/assets/fonts/css/fontawesome.min.css' );
	wp_enqueue_style( 'tow-style-fontawesome-brands', get_template_directory_uri() . '/assets/fonts/css/brands.min.css' );
	wp_enqueue_style( 'tow-style-fontawesome-solid', get_template_directory_uri() . '/assets/fonts/css/solid.min.css' );
	
	wp_enqueue_style( 'tow-style-global', get_template_directory_uri() . '/assets/css/global.css' );
    wp_enqueue_style( 'tow-style-index', get_template_directory_uri() . '/assets/css/index.css' );
	wp_enqueue_style( 'bootstrap-icons', 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css' );
}

add_action( 'wp_enqueue_scripts', 'tow_styles' );

// 2. Load the Theme JS

function tow_js()
{   
    wp_enqueue_script(
        'jquery',
        get_template_directory_uri() . '/assets/js/jquery-3.7.1.min.js',
        array( 'jquery' ),
        '',
        true
    );

    wp_enqueue_script(
        'bootstrap',
        get_template_directory_uri() . '/assets/js/bootstrap.bundle.min.js',
        array( 'jquery' ),
        '',
        true
    );
}

add_action( 'wp_enqueue_scripts', 'tow_js' );


/**************  Nvigation Menu **************/

if ( ! file_exists( get_template_directory() . '/class-wp-bootstrap-navwalker.php' ) ) {
    // File does not exist... return an error.
    return new WP_Error( 'class-wp-bootstrap-navwalker-missing', __( 'It appears the class-wp-bootstrap-navwalker.php file may be missing.', 'wp-bootstrap-navwalker' ) );
} else {
    // File exists... require it.
    require_once get_template_directory() . '/class-wp-bootstrap-navwalker.php';
}

function add_custom_submenu_class($classes, $args, $depth) {
    // Add your custom class to dropdown submenus
    $classes[] = 'drop_1';
    return $classes;
}
add_filter( 'nav_menu_submenu_css_class', 'add_custom_submenu_class', 10, 3 );


require get_template_directory() . '/inc/functions-post.php';

require_once( dirname( __FILE__ ) . '/tow-settings/theme-settings.php' );

/**
* restore wordpress classic widget editor
*/

// Disables the block editor from managing widgets in the Gutenberg plugin

add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' );

// Disables the block editor from managing widgets

add_filter( 'use_widgets_block_editor', '__return_false' );


/**************** page specific css injecting **********************/

function tow_page_specific_css() {
    if ( is_page( 'about-us' ) ) { // 'about' is the slug of the page
        wp_enqueue_style( 'tow-style-about-page', get_template_directory_uri() . '/assets/css/about.css' );
    } elseif ( is_page( 'contact-us' ) ) { // 'contact' is another page slug
        wp_enqueue_style( 'tow-style-contact-page', get_template_directory_uri() . '/assets/css/contact.css' );
    } elseif ( is_page( 'faq' ) ) { // 'contact' is another page slug
        wp_enqueue_style( 'tow-style-faq-page', get_template_directory_uri() . '/assets/css/faq.css' );
    }
}
add_action( 'wp_enqueue_scripts', 'tow_page_specific_css' );