functions.php中出现意外的$end

functions.php中出现意外的$end,php,wordpress,Php,Wordpress,我在Wordpress中收到关于functions.php文件的以下错误消息。即使删除了functions.php文件,我仍然会收到相同的错误 有人知道我能解决什么吗 编辑: php文件代码粘贴在下面。请注意,我已删除此文件,但仍会收到相同的错误 <?php // add 'Music' post type add_action( 'init', 'create_music_post_type' ); function create_music_post_type() {

我在Wordpress中收到关于functions.php文件的以下错误消息。即使删除了functions.php文件,我仍然会收到相同的错误

有人知道我能解决什么吗

编辑:

php文件代码粘贴在下面。请注意,我已删除此文件,但仍会收到相同的错误

    <?php

// add 'Music' post type

add_action( 'init', 'create_music_post_type' );
function create_music_post_type() {
    register_post_type( 'music',
        array(
            'labels' => array(
                'name' => __( 'Music' ),
                'add_new_item' => __( 'Add New Music Release' ),
                'singular_name' => __( 'Release' )
            ),
        'public' => true,
        'has_archive' => true,
        'menu_position' => 5, 
        'rewrite' => array('slug' => 'music'), 
        'supports' => array('title','editor','thumbnail')
        )
    );
}


// add 'Press' post type

add_action( 'init', 'create_press_post_type' );
function create_press_post_type() {
    register_post_type( 'press',
        array(
            'labels' => array(
                'name' => __( 'Press' ),
                'add_new_item' => __( 'Add New Press Feature' ),
                'singular_name' => __( 'Press' )
            ),
        'public' => true,
        'has_archive' => true,
        'menu_position' => 5, 
        'rewrite' => array('slug' => 'press'), 
        'supports' => array('title','editor','thumbnail')
        )
    );
}


// add 'Blog' post type

add_action( 'init', 'create_blog_post_type' );
function create_blog_post_type() {
    register_post_type( 'blog',
        array(
            'labels' => array(
                'name' => __( 'Blog' ),
                'add_new_item' => __( 'Add New Blog Post' ),
                'singular_name' => __( 'Blog' )
            ),
        'public' => true,
        'has_archive' => true,
        'menu_position' => 4, 
        'rewrite' => array('slug' => 'blog'), 
        'supports' => array('title','editor','thumbnail')
        )
    );
}

//Remove all Twenty Eleven Sidebars

add_action( 'after_setup_theme','remove_twentyeleven_all_widgets', 100 );
function remove_twentyeleven_all_widgets() {

remove_filter( 'widgets_init', 'twentyeleven_widgets_init' );
}


//Add Twitter widget area

function twitter_widgets_init() {

    register_sidebar( array(
        'name' => 'Twitter',
        'id' => 'twitter',
        'before_widget' => '<div>',
        'after_widget' => '</div>',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ) );
}
add_action( 'widgets_init', 'twitter_widgets_init' );

//Add Album widget area

function album_widgets_init() {

    register_sidebar( array(
        'name' => 'New Album',
        'id' => 'new_album',
        'before_widget' => '<div>',
        'after_widget' => '</div>',
        'before_title' => '<h2>',
        'after_title' => '</h2>',
    ) );
}
add_action( 'widgets_init', 'album_widgets_init' );


//Add thumbnail sizes

add_theme_support( 'post-thumbnails', array( 'post','page' ) );
add_image_size('album-artwork', 166, 166, true);
add_image_size('gallerix-thumbnail', 175, 114, true);

//Add custom footer message

    function remove_footer_admin () {
    echo 'Fueled by love, music and <a href="http://www.wordpress.org" target="_blank">WordPress</a> | Designed by <a href="http://www.electrickiwi.co.uk" target="_blank">Electric Kiwi</a>';
    }

    add_filter('admin_footer_text', 'remove_footer_admin'); 

?>


更新:现在似乎一切都正常。我不得不通过文件管理器删除functions.php文件,因为FTP似乎无法正常工作。通过那个上传之后,一切似乎都好了。谢谢大家的回答。

检查文件末尾是否有空格,或者您可以将代码粘贴到此处,您的链接无法提供任何关于代码到底有什么问题的信息。

试试看

  • 在文件末尾添加一个结束PHP标记
    (?>)
  • 将文件重新加载到服务器。有时,我会遇到和你一样的错误 你和它一起玩。这可能是由ftp错误引起的
  • 并选中
    }

最后。

通过文件管理器删除文件并重新加载(从其中一个函数中添加缺少的}后)解决了问题。FTP不起作用,这让我认为文件已被成功删除/覆盖,而事实上并非如此

通常意味着你缺少一个结束语,或者在添加结束语后还有一个额外的结束语。}我仍然遇到问题。即使functions.php文件已通过FTP删除,我怎么可能仍然会出现此错误?您缺少一个结尾}或有一个额外的}。您需要发布wp content/themes/powtheme/functions.php内容来解决此问题。@devo我已经发布了上面的内容。但我的主要问题是,即使删除了该文件,我仍然会收到相同的错误?现在我在@NDM这里看不到任何错误,我已经发布了上面的代码。让我困惑的是,即使删除了文件,我仍然会得到完全相同的错误。。。我现在在添加缺失的}后重新添加了它,但仍然收到错误消息。仅供参考,这不是我的答案:)@Vibs_cool我重新添加了,但即使添加了缺失的}后仍然是相同的错误