个性化阅读
专注于IT技术分析

在WordPress Penscratch主题的文件管理中找到custom-header.php

点击下载

我的网站是www.rosstheexplorer.com。

我使用Wordpress。我使用Penscratch主题。我从来没有自觉地调整过/更改过文件管理器。

我对custom-header.php进行了更改, 该更改导致我无法加载我的网站。

我的网站托管服务商(Bluehost)说, 如果我可以告诉他们文件目录, 他们可以在文件管理器中还原文件。

我不知道目录是什么。我一直通过定制->外观->编辑器访问PHP文件。

现在, 我无法再访问编辑器或仪表板, 我的错误导致我被阻止访问我的网站。

知道主题的人可以告诉我custom-header.php文件的保存位置吗?

Bluehost客户服务顾问此前曾表示

“我可以看到wp-blog-header.php, 但看不到custom-header.php。”

昨晚我对custom-header.php文件进行了更改

该代码是

<?php
/**
 *
 * @package Penscratch
 */

/**
 * Setup the WordPress core custom header feature.
 *
 * @uses penscratch_header_style()
 * @uses penscratch_admin_header_style()
 * @uses penscratch_admin_header_image()
 */
function penscratch_custom_header_setup() {
    add_theme_support( 'custom-header', apply_filters( 'penscratch_custom_header_args', array(
        'default-image'          => '', 'default-text-color'     => '666666', 'width'                  => 937, 'height'                 => 300, 'flex-height'            => true, 'wp-head-callback'       => 'penscratch_header_style', 'admin-head-callback'    => 'penscratch_admin_header_style', 'admin-preview-callback' => 'penscratch_admin_header_image', ) ) );
}
add_action( 'after_setup_theme', 'penscratch_custom_header_setup' );

if ( ! function_exists( 'penscratch_header_style' ) ) :
/**
 * Styles the header image and text displayed on the blog
 *
 * @see penscratch_custom_header_setup().
 */
function penscratch_header_style() {
    $header_text_color = get_header_textcolor();

    // If no custom options for text are set, let's bail
    // get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
    if ( HEADER_TEXTCOLOR == $header_text_color ) {
        return;
    }

    // If we get this far, we have custom styles. Let's do this.
    ?>
    <style type="text/css">
    <?php
        // Has the text been hidden?
        if ( 'blank' == $header_text_color ) :
    ?>
        .site-title, .site-description {
            position: absolute;
            clip: rect(1px, 1px, 1px, 1px);
        }
    <?php
        // If the user has set a custom color for the text use that
        else :
    ?>
        .site-title a {
            color: #<?php echo $header_text_color; ?>;
        }
    <?php endif; ?>
    </style>
    <?php
}
endif; // penscratch_header_style

if ( ! function_exists( 'penscratch_admin_header_style' ) ) :
/**
 * Styles the header image displayed on the Appearance > Header admin panel.
 *
 * @see penscratch_custom_header_setup().
 */
function penscratch_admin_header_style() {
?>
    <style type="text/css">
        .appearance_page_custom-header #headimg {
            background: white;
            border: none;
            font-family: "Roboto Slab", Georgia, Times, serif;
            font-size: 15px;
            max-width: 1092px;
        }
        #headimg .site-branding-wrapper {
            border-bottom: 3px solid #eeeeee;
            margin: 0 0 27px;
            padding: 0 0 24px;
        }
        #headimg .site-branding-wrapper:before, #headimg .site-branding-wrapper:after {
            content: "";
            display: table;
        }
        #headimg .site-branding-wrapper:after {
            clear: both;
        }
        #headimg .site-branding {
            clear: both;
            margin-top: 54px;
            margin-bottom: 14px;
            text-align: center;
        }
        #headimg h1 {
            clear: none;
            display: inline-block;
            font-size: 1.75em;
            font-weight: normal;
            letter-spacing: 1px;
            line-height: 1;
            margin: 0;
        }
        #headimg a {
            text-decoration: none;
        }
        #desc {
            color: #999 !important;
            font-size: 16px;
            font-weight: 300;
            margin: 13px auto;
        }
        #headimg .site-logo {
            max-height: 150px;
            width: auto;
            display: block;
            margin: 0 auto 27px;
        }
        #headimg .custom-header {
            border-radius: 5px;
            display: block;
            margin: 0 auto;
            margin-bottom: 27px;
            max-width: 100%;
            height: auto;
min-height:100px;
        }
    </style>
<?php
}
endif; // penscratch_admin_header_style

if ( ! function_exists( 'penscratch_admin_header_image' ) ) :
/**
 * Custom header image markup displayed on the Appearance > Header admin panel.
 *
 * @see penscratch_custom_header_setup().
 */
function penscratch_admin_header_image() {
    $style = sprintf( ' style="color:#%s;"', get_header_textcolor() );
?>
    <div id="headimg">
        <div class="site-branding-wrapper">
            <div class="site-branding">
                <?php if ( function_exists( 'jetpack_the_site_logo' ) ) jetpack_the_site_logo(); ?>
                <h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
                <div class="displaying-header-text" id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
            </div>
        </div>
        <?php if ( get_header_image() ) : ?>
        <img src="<?php header_image(); ?>" alt="" class="custom-header">
        <?php endif; ?>
    </div>
<?php
}
endif; // penscratch_admin_header_image

我变了

  'width'                  => 937, 

to

  'width'                  = 100%, 

我相信这引起了我的大问题。


#1


由于你进行了更改并且无法再进入你的网站, 因此我有2种解决方案可能对你很有效, 因为它对我有用。

我遇到了与你相同的问题, 我尝试更改标题, 甚至是functions.php, 这使我失去了对我的网站的访问权限。

注意:每次对源文件进行更改时, 请确保有备份。

方法1

  • 登录到你的主机
  • 从你的托管服务提供商获取FTP访问
  • 使用FileZilla作为FTP管理器登录到你的主机提供程序
  • 你的网站可能位于” www”文件夹中
  • 导航到你的主题> wp-content>主题> theme_name打开你之前进行过更改的源文件, 然后在其中添加备份代码。

一旦更改了之前编辑过的源文件的代码(在本例中为custom-header.php), 当然, 如果你确定问题出在custom-header.php上, 则可以登录回到你的wordpress帐户。

方法#2

  • 通过使用我之前提到的FTP客户端FileZilla, 下载wp-content(所有图像)并重新安装wordpress。
  • 重新安装后, 将wp-content添加回原始目录并重新创建网站。

#2


谢谢大家的建议。现在, 此问题已解决。

我的网站提供商是BlueHost。

我登录到BlueHost并找到了CPanel。

在这里, 你可以更改网站的PHP文件。

赞(0)
未经允许不得转载:srcmini » 在WordPress Penscratch主题的文件管理中找到custom-header.php

评论 抢沙发

评论前必须登录!