Server IP : 68.65.122.142 / Your IP : 18.190.217.122 Web Server : LiteSpeed System : Linux server167.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64 User : glenirhm ( 1318) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/glenirhm/myglenbow.ca/../public_html/wp-content/themes/education-hub-pro/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Education Hub functions and definitions. * * @link https://codex.wordpress.org/Functions_File_Explained * * @package Education_Hub */ if ( ! function_exists( 'education_hub_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 education_hub_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on Education Hub Pro, use a find and replace * to change 'education-hub-pro' to the name of your theme in all the template files. */ load_theme_textdomain( 'education-hub-pro', get_parent_theme_file_path( '/languages' ) ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. */ add_theme_support( 'post-thumbnails' ); add_image_size( 'education-hub-thumb', 360, 270 ); // This theme uses wp_nav_menu() in four location. register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'education-hub-pro' ), 'footer' => esc_html__( 'Footer Menu', 'education-hub-pro' ), 'social' => esc_html__( 'Social Menu', 'education-hub-pro' ), 'quick-links' => esc_html__( 'Quick Links Menu', 'education-hub-pro' ), 'notfound' => esc_html__( '404 Menu', 'education-hub-pro' ), ) ); /* * 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', ) ); /* * Enable support for Post Formats. */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'education_hub_custom_background_args', array( 'default-color' => 'dfdfd0', 'default-image' => '', 'wp-head-callback' => 'education_hub_custom_background_cb', ) ) ); /* * Enable support for selective refresh of widgets in Customizer. */ add_theme_support( 'customize-selective-refresh-widgets' ); /* * Add editor style. */ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; add_editor_style( 'css/editor-style' . $min . '.css' ); // Enable support for footer widgets. add_theme_support( 'footer-widgets', 4 ); /* * Enable support for custom logo. */ add_theme_support( 'custom-logo' ); // Load default block styles. add_theme_support( 'wp-block-styles' ); // Add support for responsive embeds. add_theme_support( 'responsive-embeds' ); /** * Enable support for WooCommerce */ add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-lightbox' ); // Load Supports. require get_template_directory() . '/inc/support.php'; global $education_hub_default_options; $education_hub_default_options = education_hub_get_default_theme_options(); } endif; add_action( 'after_setup_theme', 'education_hub_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 education_hub_content_width() { $GLOBALS['content_width'] = apply_filters( 'education_hub_content_width', 640 ); } add_action( 'after_setup_theme', 'education_hub_content_width', 0 ); /** * Register widget area. */ function education_hub_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Primary Sidebar', 'education-hub-pro' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here to appear in your Primary Sidebar.', 'education-hub-pro' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_html__( 'Secondary Sidebar', 'education-hub-pro' ), 'id' => 'sidebar-2', 'description' => esc_html__( 'Add widgets here to appear in your Secondary Sidebar.', 'education-hub-pro' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_html__( 'Front Page Widget Area', 'education-hub-pro' ), 'id' => 'sidebar-front-page-widget-area', 'description' => esc_html__( 'Add widgets here to appear in your Front Page.', 'education-hub-pro' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_html__( 'Front Page Lower Widget Area', 'education-hub-pro' ), 'id' => 'sidebar-front-page-widget-area-lower', 'description' => esc_html__( 'Add widgets here to appear in your Front Page.', 'education-hub-pro' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => sprintf( __( 'Extra Sidebar %d', 'education-hub-pro' ), 1 ), 'id' => 'extra-sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => sprintf( __( 'Extra Sidebar %d', 'education-hub-pro' ), 2 ), 'id' => 'extra-sidebar-2', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => sprintf( __( 'Extra Sidebar %d', 'education-hub-pro' ), 3 ), 'id' => 'extra-sidebar-3', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => sprintf( __( 'Extra Sidebar %d', 'education-hub-pro' ), 4 ), 'id' => 'extra-sidebar-4', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'education_hub_widgets_init' ); /** * Enqueue scripts and styles. */ function education_hub_scripts() { $theme_version = wp_get_theme()->get( 'Version' ); $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/third-party/font-awesome/css/font-awesome' . $min . '.css', '', '4.7.0' ); $fonts_url = education_hub_fonts_url(); if ( ! empty( $fonts_url ) ) { wp_enqueue_style( 'education-hub-google-fonts', $fonts_url, array(), null ); } wp_enqueue_style( 'education-hub-style', get_stylesheet_uri(), array(), $theme_version ); $site_design = education_hub_get_option( 'site_design' ); if ( 'edification-hub' == $site_design ) { wp_enqueue_style( 'edification-hub-style', get_template_directory_uri() . '/css/edification-hub-style.css', array(), 2.2 ); } if ( has_header_image() ) { $custom_css = '#masthead{ background-image: url("' . esc_url( get_header_image() ) . '"); background-repeat: no-repeat; background-position: center center; }'; $custom_css .= '@media only screen and (max-width:767px) { #page #masthead { background-position: center top; background-size: 100% auto; padding-top: 110px; } }'; wp_add_inline_style( 'education-hub-style', $custom_css ); } wp_enqueue_script( 'education-hub-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix' . $min . '.js', array(), '20130115', true ); wp_enqueue_script( 'jquery-cycle2', get_template_directory_uri() . '/third-party/cycle2/js/jquery.cycle2' . $min . '.js', array( 'jquery' ), '2.1.6', true ); wp_enqueue_script( 'jquery-easy-ticker', get_template_directory_uri() . '/third-party/ticker/jquery.easy-ticker' . $min . '.js', array( 'jquery' ), '2.0', true ); wp_enqueue_script( 'education-hub-custom', get_template_directory_uri() . '/js/custom' . $min . '.js', array( 'jquery' ), '1.0', true ); wp_register_script( 'education-hub-navigation', get_template_directory_uri() . '/js/navigation' . $min . '.js', array(), '20160421', true ); wp_localize_script( 'education-hub-navigation', 'EducationHubScreenReaderText', array( 'expand' => '<span class="screen-reader-text">' . esc_html__( 'expand child menu', 'education-hub-pro' ) . '</span>', 'collapse' => '<span class="screen-reader-text">' . esc_html__( 'collapse child menu', 'education-hub-pro' ) . '</span>', ) ); wp_enqueue_script( 'education-hub-navigation' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'education_hub_scripts' ); /** * Load init. */ require get_template_directory() . '/inc/init.php'; /** * Load theme updater functions. */ function education_hub_theme_updater() { if ( is_admin() ) { require_once get_template_directory() . '/updater/theme-updater.php'; } } add_action( 'after_setup_theme', 'education_hub_theme_updater' ); // Load Demo Import Class if ( class_exists( 'CatchThemesDemoImportPlugin' ) ) : require( get_template_directory() . '/inc/support/ctdi/demo-import.php' ); endif; remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); /** * Add the product's short description (excerpt) to the WooCommerce shop/category pages. The description displays after the product's name, but before the product's price. * * Ref: https://gist.github.com/om4james/9883140 * * Put this snippet into a child theme's functions.php file */ function woocommerce_after_shop_loop_item_title_short_description() { global $product; if ( ! $product->post->post_excerpt ) return; ?> <div itemprop="description"> <?php echo apply_filters( 'woocommerce_short_description', $product->post->post_excerpt ) ?> </div> <?php } add_action('woocommerce_after_shop_loop_item_title', 'woocommerce_after_shop_loop_item_title_short_description', 5); remove_action('woocommerce_before_shop_loop_item' , 'woocommerce_template_loop_product_link_open' , 10); add_filter('woocommerce_cart_item_permalink','__return_false'); add_filter( 'gettext', 'bt_rename_coupon_field_on_cart', 10, 3 ); add_filter( 'woocommerce_coupon_error', 'bt_rename_coupon_label', 10, 3 ); add_filter( 'woocommerce_coupon_message', 'bt_rename_coupon_label', 10, 3 ); add_filter( 'woocommerce_cart_totals_coupon_label', 'bt_rename_coupon_label',10, 1 ); add_filter( 'woocommerce_checkout_coupon_message', 'bt_rename_coupon_message_on_checkout' ); /** * WooCommerce * Change Coupon Text * @param string $text * @return string * @link https://gist.github.com/maxrice/8551024 */ function bt_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) { // bail if not modifying frontend woocommerce text if ( is_admin() || 'woocommerce' !== $text_domain ) { return $translated_text; } if ( 'Coupon:' === $text ) { $translated_text = 'Promotion Code:'; } if ('Coupon has been removed.' === $text){ $translated_text = 'Promotion Code has been removed.'; } if ( 'Apply coupon' === $text ) { $translated_text = 'Apply Promotion Code'; } if ( 'Coupon code' === $text ) { $translated_text = 'Promotion Code'; } return $translated_text; } // Rename the "Have a Coupon?" message on the checkout page function bt_rename_coupon_message_on_checkout() { return 'Have a Promotion Code?' . ' ' . __( 'Click here to enter your code', 'woocommerce' ) . ''; } function bt_rename_coupon_label( $err, $err_code=null, $something=null ){ $err = str_ireplace("Coupon","Promotion Code ",$err); return $err; } \add_filter( 'wc_add_to_cart_message', function( $string, $product_id = 0 ) { $start = strpos( $string, '<a href=' ) ?: 0; $end = strpos( $string, '</a>', $start ) ?: 0; return substr( $string, $end ) ?: $string; } ); function change_update_cart_text( $translated, $text, $domain ) { if( is_cart() && $translated == 'Update cart' ){ $translated = 'Update Total Due Amount'; } return $translated; } add_filter( 'gettext', 'change_update_cart_text', 20, 3 ); function remove_woocommerce_actions() { remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 ); } add_action( 'after_setup_theme', 'remove_woocommerce_actions' ); function wpb_widgets_init() { register_sidebar( array( 'name' => 'Header Widget', 'id' => 'header-widget', 'before_widget' => '<div class="hw-widget">', 'after_widget' => '</div>', 'before_title' => '<h2 class="hw-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'wpb_widgets_init' ); add_filter( 'woocommerce_order_button_text', 'woo_custom_order_button_text' ); function woo_custom_order_button_text() { return __( 'Complete Payment', 'woocommerce' ); }