duanqiang3925 2019-05-01 13:17
浏览 131

在编辑器上更新header.php时,Wordpress主题崩溃

I am currently working on a website I didn't code in the first place. It was created by someone else on Wordpress using the Sidney Theme and there is no child-theme.

Here is my problem : when I update the header.php file by going to Appearance -> Editor, the website crashes and all the CSS disappears.

Fortunalely, I made a backup of the website so I recovered it.

I never had any problem like this one. It is the first time I post on Stack Overflow so if you need any info just tell me.

The website is under version 5.1.1 of Wordpress.

Here is header.php file if it can help :

    <?php
    /**
    * The header for our theme.
    *
    * Displays all of the <head> section and everything up till <div 
    id="content">
    *
    * @package Sydney
    */
    ?><!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="profile" href="http://gmpg.org/xfn/11">
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    <?php if ( ! function_exists( 'has_site_icon' ) || ! has_site_icon() 
    ) : ?>
    <?php if ( get_theme_mod('site_favicon') ) : ?>
    <link rel="shortcut icon" href="<?php echo 
    esc_url(get_theme_mod('site_favicon')); ?>" />
    <?php endif; ?>
    <?php endif; ?>

    <?php wp_head(); ?>
    </head>

    <body <?php body_class(); ?>>

    <?php do_action('sydney_before_site'); //Hooked: sydney_preloader() ?>

    <div id="page" class="hfeed site">
    <a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'sydney' ); ?></a>

<?php do_action('sydney_before_header'); //Hooked: sydney_header_clone() ?>

<header id="masthead" class="site-header" role="banner">
    <div class="header-wrap">
        <div class="container">
            <div class="row">
            <div class="col-md-4 col-sm-8 col-xs-12">
            <?php if ( get_theme_mod('site_logo') ) : ?>
                <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php bloginfo('name'); ?>"><img class="site-logo" src="<?php echo esc_url(get_theme_mod('site_logo')); ?>" alt="<?php bloginfo('name'); ?>" /></a>
            <?php else : ?>
                <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
                <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>           
            <?php endif; ?>
            </div>
            <div class="col-md-8 col-sm-4 col-xs-12">
                <div class="btn-menu"></div>
                <nav id="mainnav" class="mainnav" role="navigation">
                    <?php wp_nav_menu( array( 'theme_location' => 'primary', 'fallback_cb' => 'sydney_menu_fallback' ) ); ?>
                </nav><!-- #site-navigation -->
            </div>
            </div>
        </div>
    </div>
</header><!-- #masthead -->

<?php do_action('sydney_after_header'); ?>

<div class="sydney-hero-area">
    <?php sydney_slider_template(); ?>
    <div class="header-image">
        <?php sydney_header_overlay(); ?>
        <img class="header-inner" src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>">
    </div>
    <?php sydney_header_video(); ?>

    <?php do_action('sydney_inside_hero'); ?>
</div>

<?php do_action('sydney_after_hero'); ?>

<div id="content" class="page-wrap">
    <div class="container content-wrapper">
        <div class="row">
  • 写回答

1条回答 默认 最新

  • duan19750503 2019-05-02 07:24
    关注

    don't use theme Editor. open your cpanel. go to your theme folder. edit your header file. then paste your code. thankyou.

    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line