{"path":"/public_html/wp-content/themes/hello-elementor/functions.php","name":"functions.php","size":7931,"extension":".php","modified":"2026-04-08T21:26:24.127779928Z","mode":420,"isDir":false,"isSymlink":false,"type":"text","content":"\u003c?php\n/**\n * Theme functions and definitions\n *\n * @package HelloElementor\n */\n\nif ( ! defined( 'ABSPATH' ) ) {\n\texit; // Exit if accessed directly.\n}\n\ndefine( 'HELLO_ELEMENTOR_VERSION', '3.4.7' );\ndefine( 'EHP_THEME_SLUG', 'hello-elementor' );\n\ndefine( 'HELLO_THEME_PATH', get_template_directory() );\ndefine( 'HELLO_THEME_URL', get_template_directory_uri() );\ndefine( 'HELLO_THEME_ASSETS_PATH', HELLO_THEME_PATH . '/assets/' );\ndefine( 'HELLO_THEME_ASSETS_URL', HELLO_THEME_URL . '/assets/' );\ndefine( 'HELLO_THEME_SCRIPTS_PATH', HELLO_THEME_ASSETS_PATH . 'js/' );\ndefine( 'HELLO_THEME_SCRIPTS_URL', HELLO_THEME_ASSETS_URL . 'js/' );\ndefine( 'HELLO_THEME_STYLE_PATH', HELLO_THEME_ASSETS_PATH . 'css/' );\ndefine( 'HELLO_THEME_STYLE_URL', HELLO_THEME_ASSETS_URL . 'css/' );\ndefine( 'HELLO_THEME_IMAGES_PATH', HELLO_THEME_ASSETS_PATH . 'images/' );\ndefine( 'HELLO_THEME_IMAGES_URL', HELLO_THEME_ASSETS_URL . 'images/' );\n\nif ( ! isset( $content_width ) ) {\n\t$content_width = 800; // Pixels.\n}\n\nif ( ! function_exists( 'hello_elementor_setup' ) ) {\n\t/**\n\t * Set up theme support.\n\t *\n\t * @return void\n\t */\n\tfunction hello_elementor_setup() {\n\t\tif ( is_admin() ) {\n\t\t\thello_maybe_update_theme_version_in_db();\n\t\t}\n\n\t\tif ( apply_filters( 'hello_elementor_register_menus', true ) ) {\n\t\t\tregister_nav_menus( [ 'menu-1' =\u003e esc_html__( 'Header', 'hello-elementor' ) ] );\n\t\t\tregister_nav_menus( [ 'menu-2' =\u003e esc_html__( 'Footer', 'hello-elementor' ) ] );\n\t\t}\n\n\t\tif ( apply_filters( 'hello_elementor_post_type_support', true ) ) {\n\t\t\tadd_post_type_support( 'page', 'excerpt' );\n\t\t}\n\n\t\tif ( apply_filters( 'hello_elementor_add_theme_support', true ) ) {\n\t\t\tadd_theme_support( 'post-thumbnails' );\n\t\t\tadd_theme_support( 'automatic-feed-links' );\n\t\t\tadd_theme_support( 'title-tag' );\n\t\t\tadd_theme_support(\n\t\t\t\t'html5',\n\t\t\t\t[\n\t\t\t\t\t'search-form',\n\t\t\t\t\t'comment-form',\n\t\t\t\t\t'comment-list',\n\t\t\t\t\t'gallery',\n\t\t\t\t\t'caption',\n\t\t\t\t\t'script',\n\t\t\t\t\t'style',\n\t\t\t\t\t'navigation-widgets',\n\t\t\t\t]\n\t\t\t);\n\t\t\tadd_theme_support(\n\t\t\t\t'custom-logo',\n\t\t\t\t[\n\t\t\t\t\t'height' =\u003e 100,\n\t\t\t\t\t'width' =\u003e 350,\n\t\t\t\t\t'flex-height' =\u003e true,\n\t\t\t\t\t'flex-width' =\u003e true,\n\t\t\t\t]\n\t\t\t);\n\t\t\tadd_theme_support( 'align-wide' );\n\t\t\tadd_theme_support( 'responsive-embeds' );\n\n\t\t\t/*\n\t\t\t * Editor Styles\n\t\t\t */\n\t\t\tadd_theme_support( 'editor-styles' );\n\t\t\tadd_editor_style( 'assets/css/editor-styles.css' );\n\n\t\t\t/*\n\t\t\t * WooCommerce.\n\t\t\t */\n\t\t\tif ( apply_filters( 'hello_elementor_add_woocommerce_support', true ) ) {\n\t\t\t\t// WooCommerce in general.\n\t\t\t\tadd_theme_support( 'woocommerce' );\n\t\t\t\t// Enabling WooCommerce product gallery features (are off by default since WC 3.0.0).\n\t\t\t\t// zoom.\n\t\t\t\tadd_theme_support( 'wc-product-gallery-zoom' );\n\t\t\t\t// lightbox.\n\t\t\t\tadd_theme_support( 'wc-product-gallery-lightbox' );\n\t\t\t\t// swipe.\n\t\t\t\tadd_theme_support( 'wc-product-gallery-slider' );\n\t\t\t}\n\t\t}\n\t}\n}\nadd_action( 'after_setup_theme', 'hello_elementor_setup' );\n\nfunction hello_maybe_update_theme_version_in_db() {\n\t$theme_version_option_name = 'hello_theme_version';\n\t// The theme version saved in the database.\n\t$hello_theme_db_version = get_option( $theme_version_option_name );\n\n\t// If the 'hello_theme_version' option does not exist in the DB, or the version needs to be updated, do the update.\n\tif ( ! $hello_theme_db_version || version_compare( $hello_theme_db_version, HELLO_ELEMENTOR_VERSION, '\u003c' ) ) {\n\t\tupdate_option( $theme_version_option_name, HELLO_ELEMENTOR_VERSION );\n\t}\n}\n\nif ( ! function_exists( 'hello_elementor_display_header_footer' ) ) {\n\t/**\n\t * Check whether to display header footer.\n\t *\n\t * @return bool\n\t */\n\tfunction hello_elementor_display_header_footer() {\n\t\t$hello_elementor_header_footer = true;\n\n\t\treturn apply_filters( 'hello_elementor_header_footer', $hello_elementor_header_footer );\n\t}\n}\n\nif ( ! function_exists( 'hello_elementor_scripts_styles' ) ) {\n\t/**\n\t * Theme Scripts \u0026 Styles.\n\t *\n\t * @return void\n\t */\n\tfunction hello_elementor_scripts_styles() {\n\t\tif ( apply_filters( 'hello_elementor_enqueue_style', true ) ) {\n\t\t\twp_enqueue_style(\n\t\t\t\t'hello-elementor',\n\t\t\t\tHELLO_THEME_STYLE_URL . 'reset.css',\n\t\t\t\t[],\n\t\t\t\tHELLO_ELEMENTOR_VERSION\n\t\t\t);\n\t\t}\n\n\t\tif ( apply_filters( 'hello_elementor_enqueue_theme_style', true ) ) {\n\t\t\twp_enqueue_style(\n\t\t\t\t'hello-elementor-theme-style',\n\t\t\t\tHELLO_THEME_STYLE_URL . 'theme.css',\n\t\t\t\t[],\n\t\t\t\tHELLO_ELEMENTOR_VERSION\n\t\t\t);\n\t\t}\n\n\t\tif ( hello_elementor_display_header_footer() ) {\n\t\t\twp_enqueue_style(\n\t\t\t\t'hello-elementor-header-footer',\n\t\t\t\tHELLO_THEME_STYLE_URL . 'header-footer.css',\n\t\t\t\t[],\n\t\t\t\tHELLO_ELEMENTOR_VERSION\n\t\t\t);\n\t\t}\n\t}\n}\nadd_action( 'wp_enqueue_scripts', 'hello_elementor_scripts_styles' );\n\nif ( ! function_exists( 'hello_elementor_register_elementor_locations' ) ) {\n\t/**\n\t * Register Elementor Locations.\n\t *\n\t * @param ElementorPro\\Modules\\ThemeBuilder\\Classes\\Locations_Manager $elementor_theme_manager theme manager.\n\t *\n\t * @return void\n\t */\n\tfunction hello_elementor_register_elementor_locations( $elementor_theme_manager ) {\n\t\tif ( apply_filters( 'hello_elementor_register_elementor_locations', true ) ) {\n\t\t\t$elementor_theme_manager-\u003eregister_all_core_location();\n\t\t}\n\t}\n}\nadd_action( 'elementor/theme/register_locations', 'hello_elementor_register_elementor_locations' );\n\nif ( ! function_exists( 'hello_elementor_content_width' ) ) {\n\t/**\n\t * Set default content width.\n\t *\n\t * @return void\n\t */\n\tfunction hello_elementor_content_width() {\n\t\t$GLOBALS['content_width'] = apply_filters( 'hello_elementor_content_width', 800 );\n\t}\n}\nadd_action( 'after_setup_theme', 'hello_elementor_content_width', 0 );\n\nif ( ! function_exists( 'hello_elementor_add_description_meta_tag' ) ) {\n\t/**\n\t * Add description meta tag with excerpt text.\n\t *\n\t * @return void\n\t */\n\tfunction hello_elementor_add_description_meta_tag() {\n\t\tif ( ! apply_filters( 'hello_elementor_description_meta_tag', true ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! is_singular() ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$post = get_queried_object();\n\t\tif ( empty( $post-\u003epost_excerpt ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\techo '\u003cmeta name=\"description\" content=\"' . esc_attr( wp_strip_all_tags( $post-\u003epost_excerpt ) ) . '\"\u003e' . \"\\n\";\n\t}\n}\nadd_action( 'wp_head', 'hello_elementor_add_description_meta_tag' );\n\n// Settings page\nrequire get_template_directory() . '/includes/settings-functions.php';\n\n// Header \u0026 footer styling option, inside Elementor\nrequire get_template_directory() . '/includes/elementor-functions.php';\n\nif ( ! function_exists( 'hello_elementor_customizer' ) ) {\n\t// Customizer controls\n\tfunction hello_elementor_customizer() {\n\t\tif ( ! is_customize_preview() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! hello_elementor_display_header_footer() ) {\n\t\t\treturn;\n\t\t}\n\n\t\trequire get_template_directory() . '/includes/customizer-functions.php';\n\t}\n}\nadd_action( 'init', 'hello_elementor_customizer' );\n\nif ( ! function_exists( 'hello_elementor_check_hide_title' ) ) {\n\t/**\n\t * Check whether to display the page title.\n\t *\n\t * @param bool $val default value.\n\t *\n\t * @return bool\n\t */\n\tfunction hello_elementor_check_hide_title( $val ) {\n\t\tif ( defined( 'ELEMENTOR_VERSION' ) ) {\n\t\t\t$current_doc = Elementor\\Plugin::instance()-\u003edocuments-\u003eget( get_the_ID() );\n\t\t\tif ( $current_doc \u0026\u0026 'yes' === $current_doc-\u003eget_settings( 'hide_title' ) ) {\n\t\t\t\t$val = false;\n\t\t\t}\n\t\t}\n\t\treturn $val;\n\t}\n}\nadd_filter( 'hello_elementor_page_title', 'hello_elementor_check_hide_title' );\n\n/**\n * BC:\n * In v2.7.0 the theme removed the `hello_elementor_body_open()` from `header.php` replacing it with `wp_body_open()`.\n * The following code prevents fatal errors in child themes that still use this function.\n */\nif ( ! function_exists( 'hello_elementor_body_open' ) ) {\n\tfunction hello_elementor_body_open() {\n\t\twp_body_open();\n\t}\n}\n\nrequire HELLO_THEME_PATH . '/theme.php';\n\nHelloTheme\\Theme::instance();\n\n\n// Load chatbot widget on all pages\nadd_action( 'wp_footer', function() {\n\techo '\u003cscript src=\"' . get_site_url() . '/wp-content/uploads/chatbot-widget.js?v=3\" defer\u003e\u003c/' . 'script\u003e';\n} );","link":""}