Файловый менеджер - Редактировать - /home/pimjdymy/public_html/zeroesops/wp-content/themes/zeroesops/functions.php
Назад
<?php /** * Zeroesops functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package Zeroesops */ define( 'CSS_PATH', get_template_directory_uri() . '/assets/css/' ); define( 'JS_PATH', get_template_directory_uri() . '/assets/js/' ); define( 'IMG_PATH', get_template_directory_uri() . '/assets/images/' ); define( 'FONTS_PATH', get_template_directory_uri() . '/assets/fonts/' ); if ( ! defined( '_S_VERSION' ) ) { // Replace the version number of the theme on each release. define( '_S_VERSION', '1.0.0' ); } /** * 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 zeroesops_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on Zeroesops, use a find and replace * to change 'zeroesops' to the name of your theme in all the template files. */ load_theme_textdomain( 'zeroesops', 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 <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( 'primary_menu' => esc_html__( 'Primary', 'zeroesops' ), 'mobile_menu' => esc_html__( 'Mobile Menu', 'zeroesops' ), ) ); /* * 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( 'zeroesops_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_action( 'after_setup_theme', 'zeroesops_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 zeroesops_content_width() { $GLOBALS['content_width'] = apply_filters( 'zeroesops_content_width', 640 ); } add_action( 'after_setup_theme', 'zeroesops_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function zeroesops_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'zeroesops' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'zeroesops' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'zeroesops_widgets_init' ); /** * Enqueue scripts and styles. */ function zeroesops_scripts() { wp_enqueue_style( 'zeroesops-bootstrap', CSS_PATH . 'vendor/bootstrap.min.css', array(), _S_VERSION ); wp_enqueue_style( 'zeroesops-cerebrisans', CSS_PATH . 'vendor/cerebrisans.css', array(), _S_VERSION ); wp_enqueue_style( 'zeroesops-fontawesome', CSS_PATH . 'vendor/fontawesome-all.min.css', array(), _S_VERSION ); wp_enqueue_style( 'zeroesops-linea-icons', CSS_PATH . 'vendor/linea-icons.css', array(), _S_VERSION ); wp_enqueue_style( 'zeroesops-swiper', CSS_PATH . 'plugins/swiper.min.css', array(), _S_VERSION ); wp_enqueue_style( 'zeroesops-animate-text', CSS_PATH . 'plugins/animate-text.css', array(), _S_VERSION ); wp_enqueue_style( 'zeroesops-animate', CSS_PATH . 'plugins/animate.min.css', array(), _S_VERSION ); wp_enqueue_style( 'zeroesops-lightgallery', CSS_PATH . 'plugins/lightgallery.min.css', array(), _S_VERSION ); wp_enqueue_style( 'zeroesops-style', get_stylesheet_uri(), array(), _S_VERSION ); wp_enqueue_script( 'zeroesops-modernizr', JS_PATH . 'vendor/modernizr-2.8.3.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-bootstrap-js', JS_PATH . 'vendor/bootstrap.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-wow', JS_PATH . 'plugins/wow.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-swiper-js', JS_PATH . 'plugins/swiper.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-lightgallery-js', JS_PATH . 'plugins/lightgallery.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-waypoints-js', JS_PATH . 'plugins/waypoints.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-countdown-js', JS_PATH . 'plugins/countdown.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-isotope-js', JS_PATH . 'plugins/isotope.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-masonry-js', JS_PATH . 'plugins/masonry.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-images-loaded-js', JS_PATH . 'plugins/images-loaded.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-wavify-js', JS_PATH . 'plugins/wavify.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-jquery-wavify-js', JS_PATH . 'plugins/jquery.wavify.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-circle-progress', JS_PATH . 'plugins/circle-progress.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-counterup', JS_PATH . 'plugins/counterup.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-animation-text', JS_PATH . 'plugins/animation-text.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-vivus', JS_PATH . 'plugins/vivus.min.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-some-plugins', JS_PATH . 'plugins/some-plugins.js', array( 'jquery' ), _S_VERSION, true ); wp_enqueue_script( 'zeroesops-main', JS_PATH . 'main.js', array( 'jquery' ), _S_VERSION, true ); // wp_style_add_data( 'zeroesops-style', 'rtl', 'replace' ); // if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { // wp_enqueue_script( 'comment-reply' ); // } } add_action( 'wp_enqueue_scripts', 'zeroesops_scripts' ); /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } add_filter('nav_menu_item_args', function ($args, $item, $depth) { if ($args->theme_location == 'primary_menu') { $title = apply_filters('the_title', $item->title, $item->ID); $args->link_before = '<span>'; $args->link_after = '</span>'; } return $args; }, 10, 3); add_filter( 'nav_menu_submenu_css_class', 'rename_sub_menus', 10, 3 ); function rename_sub_menus( $classes, $args, $depth ){ if ($args->theme_location === 'primary_menu') { foreach ( $classes as $key => $class ) { if ( $class == 'sub-menu' && $depth == 0) { $classes[ $key ] = 'submenu'; } else if ( $class == 'sub-menu' && $depth == 1) { $classes[ $key ] = 'submenu'; } else if ( $class == 'sub-menu' && $depth == 2) { $classes[ $key ] = 'submenu'; } } } return $classes; } function change_specific_menu_item_class($items, $args) { // Check if the current menu location is the one we want to modify if ($args->theme_location === 'mobile_menu') { // Replace 'mobile_menu' with your menu location // Loop through each menu item foreach ($items as &$item) { // Check if the item has the 'menu-item-has-children' class if (in_array('menu-item-has-children', $item->classes)) { // Remove the 'menu-item-has-children' class $item->classes = array_diff($item->classes, array('menu-item-has-children')); // Add a new class, e.g., 'has-submenu' $item->classes[] = 'has-children'; } } }else{ foreach ($items as &$item) { // Check if the item has the 'menu-item-has-children' class if (in_array('menu-item-has-children', $item->classes)) { // Remove the 'menu-item-has-children' class $item->classes = array_diff($item->classes, array('menu-item-has-children')); // Add a new class, e.g., 'has-submenu' $item->classes[] = 'has-children has-children--multilevel-submenu'; } } } return $items; } add_filter('wp_nav_menu_objects', 'change_specific_menu_item_class', 10, 2);
| ver. 1.4 |
Github
|
.
| PHP 8.2.30 | Генерация страницы: 0.01 |
proxy
|
phpinfo
|
Настройка