get('Name')); define('BEING_PARENT_THEME_VERSION', wp_get_theme(get_template())->get('Version')); if (!function_exists('being_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 being_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on being, use a find and replace * to change 'being' to the name of your theme in all the template files. */ load_theme_textdomain('being', 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 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'); add_image_size('being-featured-image', 2000, 1200, true); add_image_size('being-thumbnail-avatar', 100, 100, true); // This theme uses wp_nav_menu() in one location. register_nav_menus(array( 'primary-menu' => esc_html__('Primary Menu', 'being'), 'side-menu' => esc_html__('Side Menu', 'being'), 'social' => esc_html__('Social Profiles', 'being'), 'footer-menu' => esc_html__('Footer', 'being'), )); add_filter('walker_nav_menu_start_el', 'parent_menu_dropdown', 10, 4); function parent_menu_dropdown($item_output, $item, $depth, $args) { if ($args->theme_location == 'primary-menu' && !empty($item->classes) && in_array('menu-item-has-children', $item->classes)) { $menu_output = ' <span class="main-text "> <span class="text "> <span class="nav_link">' . $item->title . '</span> </span> <button class="the-arrow "> <i class="fa-solid fa-angle-down"></i> </button> </span>'; $item_output = str_replace($item->title, $menu_output, $item_output); return $item_output; } if ($args->theme_location == 'side-menu' && !empty($item->classes) && in_array('menu-item-has-children', $item->classes)) { $menu_output = ' <span class="main-text "> <span class="text "> <span class="nav_link">' . $item->title . '</span> </span> <button class="the-arrow "> <i class="fa-solid fa-angle-down"></i> </button> </span>'; $item_output = str_replace($item->title, $menu_output, $item_output); return $item_output; } return $item_output; } function add_link_atts($atts) { $atts['class'] = "nav-link"; return $atts; } add_filter('nav_menu_link_attributes', 'add_link_atts'); /* * 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. * See http://codex.wordpress.org/Post_Formats */ add_theme_support('post-formats', array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', )); // Set up the WordPress core custom background feature. add_theme_support('custom-background', apply_filters('being_custom_background_args', array( 'default-color' => '061125', '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, )); } endif; add_action('after_setup_theme', 'being_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 being_content_width() { $GLOBALS['content_width'] = apply_filters('being_content_width', 640); } add_action('after_setup_theme', 'being_content_width', 0); /** * ============================================================================ * Register widget area * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar * ============================================================================ */ function being_widgets_init() { register_sidebar(array( 'name' => esc_html__('Blog Sidebar', 'being'), 'id' => 'blog-sidebar', 'description' => esc_html__('Widgets in this area will be shown in the sidebar.', 'being'), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', )); register_sidebar(array( 'name' => esc_html__('Page Sidebar', 'being'), 'id' => 'page-sidebar', 'description' => esc_html__('Widgets in this area will be shown in the sidebar of any page.', 'being'), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', )); } add_action('widgets_init', 'being_widgets_init'); /** * ============================================================================ * Enqueue scripts and styles. * =========================================================================== */ function being_scripts() { wp_enqueue_style('fontaweasome-style', BEING_THEME_ROOT . '/assets/font/fontawesome.min.css'); wp_enqueue_style('bootstrap-grid', BEING_THEME_ROOT . '/assets/css/bootstrap-grid.css'); wp_enqueue_style('slimselect', BEING_THEME_ROOT . '/assets/css/slimselect.css'); wp_enqueue_style('being-style', BEING_THEME_ROOT . '/style.css'); wp_enqueue_style('being-main-style', BEING_THEME_ROOT . '/assets/css/main.css',array(),1.1); //Js files wp_enqueue_script('swiper', BEING_THEME_ROOT . '/assets/js/vendor/swiper-bundle.min.js', array( 'jquery' ), null, true); wp_enqueue_script('lenis', BEING_THEME_ROOT . '/assets/js/vendor/lenis.min.js', array( 'jquery' ), null, true); wp_enqueue_script('gsap', BEING_THEME_ROOT . '/assets/js/vendor/gsap-latest-beta.min.js', array( 'jquery' ), null, true); wp_enqueue_script('ScrollTrigger', BEING_THEME_ROOT . '/assets/js/vendor/ScrollTrigger.min.js', array( 'jquery' ), null, true); wp_enqueue_script('in-view', BEING_THEME_ROOT . '/assets/js/vendor/in-view.min.js', array( 'jquery' ), null, true); wp_enqueue_script('being-js', BEING_THEME_ROOT . '/assets/js/main.js?' . date("h:i:sa"), array( 'jquery' ), null, true); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } } add_action('wp_enqueue_scripts', 'being_scripts'); /** * Modifies tag cloud widget arguments to display all tags in the same font size * and use list format for better accessibility. * * * @param array $args Arguments for tag cloud widget. * @return array The filtered arguments for tag cloud widget. */ function being_widget_tag_cloud_args($args) { $args['largest'] = 1; $args['smallest'] = 1; $args['unit'] = 'em'; $args['format'] = 'list'; return $args; } add_filter('widget_tag_cloud_args', 'being_widget_tag_cloud_args'); /** * ============================================================================ * Enqueue google font * =========================================================================== */ add_action('wp_enqueue_scripts', 'being_child_load_google_fonts'); /** * Enqueue Google Fonts using a function */ function being_child_load_google_fonts() { // Setup font arguments $query_args = array( 'family' => 'Tajawal:wght@200;300;400;500;700;800;900&display=swap' ); wp_register_style('google-fonts', add_query_arg($query_args, "//fonts.googleapis.com/css2"), array(), null); wp_enqueue_style('google-fonts'); } /** * ============================================================================ * Enqueue the Dashicons script * =========================================================================== */ add_action('wp_enqueue_scripts', 'being_load_dashicons_front_end'); function being_load_dashicons_front_end() { wp_enqueue_style('dashicons'); } /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-helper.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/kirki-customizer.php'; /** * Load Jetpack compatibility file. */ if (defined('JETPACK__VERSION')) { require get_template_directory() . '/inc/jetpack.php'; } require_once get_template_directory() . '/inc/variables.php'; add_action('admin_enqueue_scripts', 'being_admin_custom_scripts'); function being_admin_custom_scripts() { wp_enqueue_media(); wp_enqueue_style('customizer-style', get_template_directory_uri() . '/inc/css/customizer-style.css', array()); wp_register_script('being-admin-custom', get_template_directory_uri() . '/inc/js/admin_custom.js', ['jquery'], '', true); wp_enqueue_script('being-admin-custom'); } // being_comment if (!function_exists('being_comment')) { function being_comment($comment, $args, $depth) { $GLOBAL['comment'] = $comment; extract($args, EXTR_SKIP); $args['reply_text'] = 'Reply'; $replayClass = 'comment-depth-' . esc_attr($depth); ?> <li id="comment-<?php comment_ID(); ?>"> <div class="comments-box post-comment-box d-sm-flex align-items-start"> <div class="post-comment-info"> <div class="post-comment-avater comments-avatar"> <?php print get_avatar($comment, 102, null, null, ['class' => []]); ?> </div> </div> <div class="post-comment-text "> <div class="post-comment-name"> <span class="post-meta"><?php comment_time(get_option('date_format')); ?></span> <h5><?php print get_comment_author_link(); ?></h5> </div> <?php comment_text(); ?> <div class="post-comment-reply"> <?php comment_reply_link(array_merge($args, ['depth' => $depth, 'max_depth' => $args['max_depth']])); ?> </div> </div> </div> <?php } } add_filter( 'nav_menu_link_attributes', 'being_hash_link_scroll_attr', 10, 3 ); function being_hash_link_scroll_attr( $atts, $item, $args ) { $link = $atts['href']; if (!filter_var($link, FILTER_VALIDATE_URL)) { $atts['data-scrol'] = str_replace("#","",$atts['href']); $atts['href'] = '#'; } return $atts; }