Поддержка Проблемы и решения Перестало открываться меню на мобильных системах

  • Перестало открываться главное меню (надпись: Menu) в мобильных системах.
    Убирал скрипты, не помогло(

    Страница, с которой нужна помощь: [войдите, чтобы увидеть ссылку]

Просмотр 13 ответов — с 1 по 13 (всего 13)
  • я не вижу никаких скриптов, привязанных к этой кнопке.

    так что признавайтесь — что химичили перед тем, как кнопка перестала работать?

    уже много времени прошло, не смогу вспомнить(
    видимо что-то с CSS блокируется

    я не знаю, где вы взяли эту тему — она больно старая и сайт разработчика не работает. но советую найти дистрибутив и сравнить разницу.

    Здесь тема, если сжать браузер то можно увидеть меню для мобильных.
    Пока разницу не нашел(

    а я вот меню не вижу, только кнопку.

    И все-таки не хватало скрипта, поставил так:
    <script src="/wp-includes/js/jquery/jquery.js?ver=1.12.4"></script>

    это неправильно.
    правильно добавить в functions.php код:

    
    function my_scripts_styles() {
        if(!wp_script_is('jquery')) {wp_enqueue_script('jquery');}
    }
    add_action( 'wp_enqueue_scripts', 'my_scripts_styles' );
    

    не сработало

    мой код functions.php:

    <?php 
    /***************************************************************/
    /* Define Constant */
    /***************************************************************/
    define( 'HOME_URI', home_url() );
    define( 'THEME_URI', get_template_directory_uri() );
    define( 'THEME_IMAGES', THEME_URI . '/images' );
    define( 'THEME_CSS', THEME_URI . '/css' );
    define( 'THEME_JS', THEME_URI . '/js' );
    
    /***************************************************************/
    /* Exray class */
    /***************************************************************/
    require 'classes/exray.php';
    
    /***************************************************************/
    /* Theme template / parts */
    /***************************************************************/
    require ('functions/exray-theme-template.php');
    // require ('functions/exray-theme-options.php');
    require ('functions/exray-theme-stylesheet.php');
    require ('functions/exray-theme-customizer.php');
    require('functions/exray-theme-banner.php');
    
    add_action( 'customize_register', 'exray_load_customize_controls', 0 );
    
    function exray_load_customize_controls() {
    	require_once( trailingslashit( get_template_directory() ) . '/functions/control-radio-image.php' );
        require_once( trailingslashit( get_template_directory() ) . '/functions/control-checkbox-multiple.php' );
    }
    
    /* Global Variable */
    $default_options = array('toggle_menu'=> array(''), 'layout_options' => 'default', 'content_options' => 'default', 'go_to_top_navigation' => false);
    $exray_general_options = get_option('exray_theme_general_options', $default_options);
    $exray = new Exray;
    
    $exray->set_max_content_width(542);
    $exray->get_max_content_width();
    $exray->set_aside_symbol(true);
    
    /***************************************************************/
    /* Add Post Thumbnail and Post Format Theme Support*/
    /***************************************************************/
    add_action( 'after_setup_theme', 'exray_setup' );
    
    function exray_setup(){
    	add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
    	add_theme_support('post-formats', array('link', 'quote', 'gallery', 'aside'));
    	add_theme_support('automatic-feed-links');
    	add_theme_support('post-thumbnails', array('post'));
    	add_theme_support( 'title-tag' );
    	set_post_thumbnail_size( 150, 150, true);	// Post Thumbnail default size 	
    	load_theme_textdomain( 'exray', THEME_URI. '/languages' );
    	
    	register_nav_menus(
    		array(
    		  'top-menu' => __( 'Top Menu', 'exray' ),
    		  'main-menu' => __( 'Main Menu', 'exray' )
    		)
    	);
    }
    
    /***************************************************************/
    /* Enqueu scripts and stylesheet */
    /***************************************************************/
    add_action('wp_enqueue_scripts', 'exray_scripts_styles');
    
    function exray_scripts_styles(){
    	wp_enqueue_style( 'style.css', get_stylesheet_uri(),'', false, 'all' );
    	wp_enqueue_script( 'custom_scripts', THEME_JS . '/scripts.js', array('jquery'), false, true );
    }
    
    add_action('admin_enqueue_scripts', 'exray_admin_scripts');
    
    function exray_admin_scripts(){
    	wp_enqueue_style( 'radio_image_style', THEME_CSS . '/customize-controls.css');
    	wp_enqueue_script('jquery-ui-button');
    	wp_enqueue_script( 'multicheckbox_customizer', get_template_directory_uri() . '/js/customize-controls.js', array('jquery'), false, true );
    }
    
    /***************************************************************/
    /* add ie conditional html5 shim to header  */
    /***************************************************************/
    add_action('wp_head', 'add_ie_html5_shim');
    
    function add_ie_html5_shim () {
        echo '<!--[if lt IE 9]>';
        echo '<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>';
        echo '<![endif]-->';
    }
    
    /***************************************************************/
    /* Sanitize options on customizer  */
    /***************************************************************/
    function exray_sanitize_text( $input ) {
        return wp_kses_post( force_balance_tags( $input ) );
    }
    
    function exray_sanitize_checkbox( $input ) {
        if ( $input == 1 ) {
            return 1;
        } else {
            return '';
        }
    }
    
    function exray_sanitize_toggle_menu( $input ) {
    	$valid = array(
    		'top_menu'      => __( 'Hide top menu ',      'exray' ),
    		'main_menu'     => __( 'Hide main menu',     'exray' ),
    	);
    
        if ( array_key_exists( $input, $valid ) ) {
            return $input;
        } else {
            return array('');
        }
    }
    
    function exray_sanitize_content( $input ) {
    	$valid = array(
    		'default'  => __('Excerpt ' , 'exray'),
    		'full' => __(' Full post with readmore' , 'exray'),
    	);
    
        if ( array_key_exists( $input, $valid ) ) {
            return $input;
        } else {
            return array('default');
        }
    }
    
    function exray_sanitize_pagination( $input ) {
    	$valid = array(
    		'default'  => __('Paginated Link' , 'exray'),
    		'old' => __('Prev / Next Link (Old)' , 'exray'),
    	);
    
        if ( array_key_exists( $input, $valid ) ) {
            return $input;
        } else {
            return array('default');
        }
    }
    
    function exray_sanitize_layout( $input ) {
    	$valid = array(
    		'default' => array(
    			'label' => esc_html__( 'Default', 'exray' ),
    			'url'   => get_template_directory_uri(). '/images/default.png'
    		),
    		'content_sidebar' => array(
    			'label' => esc_html__( 'Content / Sidebar', 'exray' ),
    			'url'   => get_template_directory_uri(). '/images/content-sidebar.png'
    		),
    		'sidebar_content' => array(
    			'label' => esc_html__( 'Sidebar / Content', 'exray' ),
    			'url'   => get_template_directory_uri(). '/images/sidebar-content.png'
    		),
    		'full_content' => array(
    			'label' => esc_html__( 'Fullwidth', 'exray' ),
    			'url'   => get_template_directory_uri(). '/images/content.png'
    		)
    	);
    
        if ( array_key_exists( $input, $valid ) ) {
            return $input;
        } else {
            return 'default';
        }
    }
    
    function exray_sanitize_image( $input ){
     
        /* default output */
        $output = '';
     
        /* check file type */
        $filetype = wp_check_filetype( $input );
        $mime_type = $filetype['type'];
     
        /* only mime type "image" allowed */
        if ( strpos( $mime_type, 'image' ) !== false ){
            $output = $input;
        }
     
        return $output;
    }
    
    function mojFavicon() {
    echo '<link rel="Shortcut Icon" type="image/x-icon" href="http://np-expert12.ru/favicon.ico" />';
    }
    add_action( 'admin_head', 'mojFavicon' );
    
    // Удаляем link rel='prev' и link rel='next'
    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
    remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
    
        // Отключаем сам REST API
        add_filter('rest_enabled', '__return_false');
    
        // Отключаем фильтры REST API
        remove_action( 'xmlrpc_rsd_apis',            'rest_output_rsd' );
        remove_action( 'wp_head',                    'rest_output_link_wp_head', 10, 0 );
        remove_action( 'template_redirect',          'rest_output_link_header', 11, 0 );
        remove_action( 'auth_cookie_malformed',      'rest_cookie_collect_status' );
        remove_action( 'auth_cookie_expired',        'rest_cookie_collect_status' );
        remove_action( 'auth_cookie_bad_username',   'rest_cookie_collect_status' );
        remove_action( 'auth_cookie_bad_hash',       'rest_cookie_collect_status' );
        remove_action( 'auth_cookie_valid',          'rest_cookie_collect_status' );
        remove_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 );
    
        // Отключаем события REST API
        remove_action( 'init',          'rest_api_init' );
        remove_action( 'rest_api_init', 'rest_api_default_filters', 10, 1 );
        remove_action( 'parse_request', 'rest_api_loaded' );
    
        // Отключаем Embeds связанные с REST API
        remove_action( 'rest_api_init',          'wp_oembed_register_route'              );
        remove_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );
    
        remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
        // если собираетесь выводить вставки из других сайтов на своем, то закомментируйте след. строку.
        remove_action( 'wp_head',                'wp_oembed_add_host_js'                 );
    	
    // Чтобы не убирало тег SPAN
    function wph_add_all_elements($init) {
        if(current_user_can('unfiltered_html')) {
            $init['extended_valid_elements'] = 'span[*]';
        }
        return $init;
    }
    add_filter('tiny_mce_before_init', 'wph_add_all_elements', 20);	
    
    // Чтобы jquery-migrate.min.js в футер
    function scripts_migrate() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', '/wp-includes/js/jquery/jquery-migrate.min.js', array(), null, true );
        wp_enqueue_script( 'jquery', true);
    }     
    add_action( 'wp_enqueue_scripts', 'scripts_migrate' );
    
    

    вот эту хрень, кто вам посоветовал вставить?

    
    // Чтобы jquery-migrate.min.js в футер
    function scripts_migrate() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', '/wp-includes/js/jquery/jquery-migrate.min.js', array(), null, true );
        wp_enqueue_script( 'jquery', true);
    }     
    add_action( 'wp_enqueue_scripts', 'scripts_migrate' );
    

    удалите на фиг.

    спасибо, а вообще важен jquery-migrate.min.js ?

    он автоматом подрубится движком при подключении jquery.

Просмотр 13 ответов — с 1 по 13 (всего 13)
  • Тема «Перестало открываться меню на мобильных системах» закрыта для новых ответов.