Файловый менеджер - Редактировать - /var/www/vhosts/allit.dev1.mndrn.cloud/wp-content/themes/allit/functions.php
Назад
<?php /** * wtsp functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package wtsp */ function register_my_session(){ if( !session_id() ) { session_start(); } } add_action('init', 'register_my_session'); if ( ! function_exists( 'ddwd_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 ddwd_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on ddwd, use a find and replace * to change 'ddwd' to the name of your theme in all the template files. */ load_theme_textdomain( 'ddwd', 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' ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5',[ 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ]); } endif; add_action( 'after_setup_theme', 'ddwd_setup' ); // Function to change email address function wpb_sender_email( $original_email_address ) { return 'no-reply@wordpress.test'; } add_filter( 'wp_mail_from', 'wpb_sender_email' ); // Function to change sender name function wpb_sender_name( $original_email_from ) { return get_bloginfo('name'); //ex. 'Wordpress Test'; } add_filter( 'wp_mail_from_name', 'wpb_sender_name' ); /* Add the default style and some other */ add_action( 'wp_enqueue_scripts', 'wtsp_my_styles_method'); function wtsp_my_styles_method() { wp_enqueue_style( 'style', get_stylesheet_uri() ); wp_enqueue_style( 'fontawesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css', [ ], '6.1.1' ); wp_enqueue_style( 'icons', get_template_directory_uri() . '/dist/icons/icons.css', ['style'], '20200126' ); wp_enqueue_style( 'slick-carousel', 'https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.css', [ ], '1.9.0' ); wp_enqueue_style( 'slick-carousel-theme', 'https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick-theme.css', ['slick-carousel'], '1.9.0' ); wp_enqueue_style( 'animate-css', 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.min.css', [], '4.0.0' ); wp_enqueue_style( 'flowbite', 'https://cdnjs.cloudflare.com/ajax/libs/flowbite/2.2.1/flowbite.min.css', [], '2.2.1' ); wp_enqueue_style( 'main', get_template_directory_uri() . '/dist/styles/main.css', ['style', 'fontawesome', 'icons'], '' ); } /* Add some js scripts */ add_action( 'wp_enqueue_scripts', 'wtsp_my_scripts_method'); function wtsp_my_scripts_method() { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'lodash' ); wp_enqueue_script( 'slick', 'https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.js', ['jquery'], '1.9.0', true ); wp_enqueue_script( 'flowbite', 'https://cdnjs.cloudflare.com/ajax/libs/flowbite/2.2.1/flowbite.min.js', [], '2.2.1', true ); wp_enqueue_script( 'main', get_template_directory_uri() . '/dist/scripts/main.js', ['jquery', 'slick'], '', true ); } /* Enamble custom thumbnail sizes */ if ( function_exists( 'add_image_size' ) ) { add_image_size( '1920', 1920 ); add_image_size( '800x600', 800, 600, true ); } /* Customize the excerpt lenght */ add_filter( 'excerpt_more', 'wtsp_new_excerpt_more' ); function wtsp_new_excerpt_more( $more ) { return '…'; } /* Enable custom menu */ add_action( 'init', 'wtsp_register_my_menu' ); function wtsp_register_my_menu( ) { register_nav_menu( 'mainmenu', 'Main menu of the theme'); register_nav_menu( 'menumobile', 'Main menu mobile'); register_nav_menu( 'footermenu', 'Footer menu of the theme'); } function wtsp_content_width() { $GLOBALS['content_width'] = apply_filters( 'wtsp_content_width', 1200 ); } add_action( 'after_setup_theme', 'wtsp_content_width', 0 ); /* Title Tag */ if ( ! function_exists( '_wp_render_title_tag' ) ) { function wtsp_render_title() { ?> <title><?php wp_title( '-', true, 'right' ); ?></title> <?php } add_action( 'wp_head', 'wtsp_render_title' ); } if( function_exists('acf_add_options_page') ) { acf_add_options_page(); } function add_additional_class_on_li($classes, $item, $args) { if(isset($args->add_li_class)) { $classes[] = $args->add_li_class; } return $classes; } add_filter('nav_menu_css_class', 'add_additional_class_on_li', 1, 3); // Create a function that adds the font selector if ( ! function_exists( 'ddwd_mce_buttons' ) ) { function ddwd_mce_buttons( $buttons ) { array_unshift( $buttons, 'fontsizeselect' ); // Add Font Size Select return $buttons; } } // Hook the function the mce buttons event add_filter( 'mce_buttons_2', 'ddwd_mce_buttons' ); // Everything that follows is OTIONAL --- // The following is only if you want to customize the default font sizes // Create a function to Customize mce editor font sizes if ( ! function_exists( 'ddwd_mce_text_sizes' ) ) { function ddwd_mce_text_sizes( $initArray ){ $initArray['fontsize_formats'] = "9px 10px 12px 13px 14px 16px 18px 21px 24px 28px 32px 36px 40px"; return $initArray; } } // Hook the function in the mce before init event add_filter( 'tiny_mce_before_init', 'ddwd_mce_text_sizes' );
| ver. 1.4 |
Github
|
.
| PHP 8.2.5 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка