Задать вопрос
@Tempest99

Почему пропала меню админка WP?

при попытке перехода в админку вордпресс выдает ошибку.По инфе из интернета дело в пробелах,но как я вижу,лишних пробелов нету,как в functions.php, так и в pluggable.php. В чем проблема?

Warning: Cannot modify header information - headers already sent by (output started at C:\Users\tempe\Downloads\OSPanel\domains\wp-dev\wp-content\themes\sparrow\functions.php:63) in C:\Users\tempe\Downloads\OSPanel\domains\wp-dev\wp-includes\pluggable.php on line 1265

Warning: Cannot modify header information - headers already sent by (output started at C:\Users\tempe\Downloads\OSPanel\domains\wp-dev\wp-content\themes\sparrow\functions.php:63) in C:\Users\tempe\Downloads\OSPanel\domains\wp-dev\wp-includes\pluggable.php on line 1268

functions.php
<?php 
	add_action( 'wp_enqueue_scripts', 'my_scripts_method');
	add_action('wp_enqueue_scripts', 'style_theme');
	add_action('wp_footer', 'scripts_theme');
	add_action( 'after_setup_theme', 'theme_register_nav_menu' );
	add_action( 'widgets_init', 'register_my_widgets' );

	function my_scripts_method() {
	    wp_deregister_script('jquery');
	    wp_enqueue_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js');
		}  
	    
	function style_theme() {
		wp_enqueue_style('style', get_stylesheet_uri());
		wp_enqueue_style('default', get_template_directory_uri() . '/assets/css/default.css' );
		wp_enqueue_style('layout', get_template_directory_uri() . '/assets/css/layout.css' );
		wp_enqueue_style('media-queries', get_template_directory_uri() . '/assets/css/media-queries.css' );
		add_action( 'widgets_init', 'register_my_widgets' );
	}
	
	function scripts_theme() {
		wp_enqueue_script('flexslider', get_template_directory_uri() . '/assets/js/jquery.flexslider.js');
		wp_enqueue_script('doubletaptogo', get_template_directory_uri() . '/assets/js/doubletaptogo.js');
		wp_enqueue_script('init', get_template_directory_uri() . '/assets/js/init.js');
		wp_enqueue_script('modernizr', get_template_directory_uri() . '/assets/js/modernizr.js');
	} 

	function theme_register_nav_menu() {
		register_nav_menu( 'top', 'Меню в шапке' );
		register_nav_menu( 'footer', 'Меню в подвале' );
	}

	function register_my_widgets(){
		register_sidebar( array(
			'name'          => 'Right sidebar',
			'id'            => "right-sidebar",
			'before_widget' => '<div class="widget %2$s">',
			'after_widget'  => "</div>\n",
			'before_title'  => '<h5 class="widgettitle">',
			'after_title'   => "</h5>\n",
		) );

		register_sidebar( array(
			'name'          => 'Top sidebar',
			'id'            => "top-sidebar",
			'before_widget' => '<div class="widget %2$s">',
			'after_widget'  => "</div>\n",
			'before_title'  => '<h5 class="widgettitle">',
			'after_title'   => "</h5>\n",
		) );
	}
	
	function my_search_form( $form ) {
	        $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . home_url( '/' ) . '" >
	        <div><label class="screen-reader-text" for="s">' . __( 'Search for:' ) . '</label>
	        <input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="Search here..." />
	        <input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search' ) .'" />
	        </div>	        </form>';
	        return $form;
	    }   
	add_filter( 'get_search_form', 'my_search_form', 100 )
;?>


pluggable.php со строчки 1248 по 1272
if ( ! $is_IIS && PHP_SAPI != 'cgi-fcgi' ) {
			status_header( $status ); // This causes problems on IIS and some FastCGI setups
		}

		/**
		 * Filters the X-Redirect-By header.
		 *
		 * Allows applications to identify themselves when they're doing a redirect.
		 *
		 * @since 5.1.0
		 *
		 * @param string $x_redirect_by The application doing the redirect.
		 * @param int    $status        Status code to use.
		 * @param string $location      The path to redirect to.
		 */
		$x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location );
		if ( is_string( $x_redirect_by ) ) {
			header( "X-Redirect-By: $x_redirect_by" );
		}

		header( "Location: $location", true, $status );

		return true;
	}
endif;
  • Вопрос задан
  • 238 просмотров
Подписаться 1 Простой 2 комментария
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы