args = $args; $this->Method = array( 'GETs'=>$_GET, 'POSTs'=>$_POST, ); $this->TempPath = get_template_directory(); $this->TempURL = get_template_directory(); $this->StylesURL = get_template_directory_uri().'/components/styles/'; $this->StylesPath = get_template_directory().'/components/styles/'; $this->folderpath = $this->TempPath.'/components/packs/*/'; $this->packsPath = $this->TempPath.'/components/packs/'; $this->Packages = array_filter(glob($this->folderpath), 'is_dir'); if( !class_exists('ThemeStatic') ) { require($this->TempPath.'/syntax.php'); } } public function AddTaxonomy($id, $ptypes=array(), $name, $rewrite=false, $hierarchical=true) { $labels = array( 'name' => __($name, 'PtypeLocalize' , 'post type general name'), 'all_items' => __('all items', 'PtypeLocalize' , 'all items'), 'add_new_item' => __('Add a new item', 'PtypeLocalize' , 'adding a new item'), 'new_item_name' => __('New item name', 'PtypeLocalize' , 'adding a new item'), ); register_taxonomy( $id, $ptypes, array( 'hierarchical' => $hierarchical, 'rewrite' => $rewrite, 'labels' => $labels, ) ); } public function AddPType($name, $singlename, $plus='', $id, $public=true, $rewrite=false, $supports=array(), $position='') { $labels = array( 'name' => __( $name, 'post type general name', 'MycimaLocalize' ), 'singular_name' => __( $name, 'post type singular name', 'MycimaLocalize' ), 'menu_name' => __( $name, 'admin menu', 'MycimaLocalize' ), 'name_admin_bar' => __( $name, 'add new on admin bar', 'MycimaLocalize' ), 'add_new' => __( 'Add new', 'search', 'MycimaLocalize' ), 'add_new_item' => __( 'إضافة '.$singlename.' new'.$plus, 'MycimaLocalize' ), 'new_item' => __( $singlename.' new'.$plus, 'MycimaLocalize' ), 'edit_item' => __( 'amendment '.$singlename, 'MycimaLocalize' ), 'all_items' => __( 'all '.$name, 'MycimaLocalize' ), 'search_items' => __( 'search in'.$name, 'MycimaLocalize' ), 'parent_item_colon' => __( $singlename.'President', 'MycimaLocalize' ), 'not_found' => __( 'There are no items.', 'MycimaLocalize' ), 'not_found_in_trash' => __( 'There are no items in the trash.', 'MycimaLocalize' ) ); $args = array( 'labels' => $labels, 'public' => $public, 'rewrite' => $rewrite, 'supports' => $supports, ); if( is_numeric($position) ) { $args['menu_position'] = $position; } register_post_type( $id, $args ); } public function Require($path, $vars=array()) { extract($vars); if( file_exists($path) ) { require($path); }else { echo '

This path does not exist:'.$path.'

'; } } public function Initialize() { do_action('Initialize'); } } $ThemeTree = new ThemeTree(); add_action('init', array($ThemeTree, 'Initialize')); $ThemeStatic = new ThemeStatic(); $packs = $ThemeTree->Packages; foreach ($packs as $pack) { if( substr(basename($pack), 0, 1) != '@' and substr(basename($pack), 0, 1) != '#' ) { $path = $pack.'setup.php'; $ThemeTree->Require($path, array('CurrentDir'=>$pack)); } } wp_reset_query(); add_action( 'wp_enqueue_scripts', function() { if ( ! is_admin() ) { wp_dequeue_style( 'qm-admin-css' ); } }, 100 ); add_filter( 'wpseo_next_rel_link', '__return_false' ); add_filter( 'wpseo_prev_rel_link', '__return_false' ); function my_lazyload_content_images( $content ) { // Replace img src $content = preg_replace( '/(]+)(src\s*=\s*[\'"]([^"\']*)[\'"])/Ui', '$1data-src="$3"', $content ); // Replace img srcset $content = preg_replace( '/(]+)(srcset\s*=\s*[\'"]([^"\']*)[\'"])/Ui', '$1data-srcset="$3"', $content ); // Replace iframe src $content = preg_replace( '/(]*)(src)/Ui', '$1data-src="$2"', $content ); return $content; } // Apply to post content and widgets add_filter( 'the_content', 'my_lazyload_content_images' ); add_filter( 'widget_text', 'my_lazyload_content_images' ); // Disable Query Monitor CSS add_action( 'wp_enqueue_scripts', function() { if ( ! is_admin() ) { wp_dequeue_style( 'qm-admin-css' ); } }, 100 ); //Remove Gutenberg Block Library CSS from loading on the frontend function smartwp_remove_wp_block_library_css(){ wp_dequeue_style( 'wp-block-library' ); wp_dequeue_style( 'wc-block-style' ); // Remove WooCommerce block CSS if(!is_page()){ wp_deregister_script( 'contact-form-7' ); } wp_dequeue_style( 'contact-form-7' ); // Remove WooCommerce block CSS wp_dequeue_style( 'contact-form-7-rtl' ); // Remove WooCommerce block CSs wp_dequeue_style( 'ez-icomoon' ); // Remove WooCommerce block CSS wp_dequeue_style( 'ez-toc' ); // Remove WooCommerce block CSS wp_dequeue_script( 'contact-form-7' ); } add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 ); add_filter( 'rank_math/frontend/disable_adjacent_rel_links', '__return_true' ); add_action( 'wp_print_scripts', function() { wp_dequeue_script( 'contact-form-7' ); wp_dequeue_script( 'contact-form-7-swfupload' ); }, 100 ); function disable_classic_theme_styles() { wp_deregister_style('classic-theme-styles'); wp_dequeue_style('classic-theme-styles'); } if(!is_admin()){ add_filter('wp_enqueue_scripts', 'disable_classic_theme_styles', 100); } add_filter( 'rank_math/frontend/disable_adjacent_rel_links', '__return_true' ); add_action( 'wp_enqueue_scripts', 'deregister_styles', 20 ); function deregister_styles() { wp_dequeue_style( 'classic-theme-styles' ); wp_dequeue_style( 'ez-toc' ); wp_dequeue_style( 'yasrcss' ); wp_dequeue_style( 'ez-icomoon' ); } function smartwp_remove_specific_css(){ wp_dequeue_style( 'screen' ); // Remove the screen.min.css file } // Hook into the 'wp_enqueue_scripts' action add_action( 'wp_enqueue_scripts', 'smartwp_remove_specific_css' ); add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 ); add_filter( 'rank_math/frontend/disable_adjacent_rel_links', '__return_true' ); function custom_comment_status($commentdata) { if (!is_user_logged_in() && isset($_POST['approve_comment']) && $_POST['approve_comment'] != '1') { $commentdata['comment_approved'] = 0; } return $commentdata; } add_filter('preprocess_comment', 'custom_comment_status'); function disable_unnecessary_scripts() { wp_dequeue_script( 'jquery' ); // إزالة ملف jQuery wp_dequeue_script( 'wp-embed' ); // إزالة ملف wp-embed wp_dequeue_script( 'wp-emoji' ); // إزالة ملف wp-emoji wp_dequeue_script( 'comment-reply' ); // إزالة ملف comment-reply } add_action( 'wp_enqueue_scripts', 'disable_unnecessary_scripts', 999 ); TemplatePart('home'); ?>