PHP:Wordpress Theme的functions.php文件意外结束

时间:2016-01-25 10:04:58

标签: php syntax-error wordpress-theming

我一直在使用WordPress"提升"我的一个网站的主题。现在我需要将整个网站移动到新服务器,并且我不断收到由以下错误消息引起的错误500:

mod_fcgid: stderr: PHP Parse error:  syntax error, unexpected end of file in /var/www/vhosts/.../themes/elevate/functions.php on line 290

(290是最后一行,我已从代码段中删除了一些注释。)functions.php文件与旧服务器上的相同。旧的运行PHP 5.3.29,新的运行5.3.3。切换到任何其他版本的PHP都无法解决问题。

我花了一整天的时间来分析代码,但我还没有发现任何问题 - 最令我惊讶的是,它在老机器上没有任何问题。

如果有人能指出我的解决方案,我真的很感激。

<?php
if ( ! function_exists( 'mythology_setup' ) ) :
function mythology_setup() {

        /* CONTENT WIDTH */
        if ( ! isset( $content_width ) )
        $content_width = 1120; /* pixels */

        /* THEME URL CONSTANT */
        if(!defined('WP_THEME_URL')) {
                define( 'WP_THEME_URL', get_template_directory_uri());
        }

        /* ---------------------------------------------------------*/
        /* INITIALIZE MYTHOLOGY CORE */

        /* OPTIONTREE LOADER */
        require get_template_directory() . '/mythology-core/mythology-optiontree-loader.php';

                load_template( trailingslashit( get_template_directory() ) . 'theme-core/ot-theme-options.php' ); // Load theme options.
                load_template( trailingslashit( get_template_directory() ) . 'theme-core/ot-meta-boxes.php' ); // Load Page/Post options.

        /* OPTIONTREE GOOGLE FONTS LOADER */
        // require get_template_directory() . '/mythology-core/mythology-otgooglefonts-loader.php';

        /* CORE PLUGINS */
        require get_template_directory() . '/mythology-core/mythology-plugin-loader.php';

        /* CORE FUNCTIONS */
        require get_template_directory() . '/mythology-core/mythology-core-functions.php';

        /* CORE STYLESHEETS */
        require get_template_directory() . '/mythology-core/mythology-register-stylesheets.php';

        /* CORE SCRIPTS */
        require get_template_directory() . '/mythology-core/mythology-register-scripts.php';

        /* CORE COMMENTS */
        require get_template_directory() . '/mythology-core/mythology-comments.php';

        /* CORE VT-RESIZE */
        $imgwidth = "750";
        $imgheight = "2000";
        $imagecrop = "true";
        require get_template_directory() . '/mythology-core/mythology-vt-resize.php';


        /* DEACTIVATE ANY CORE STYLESHEETS/SCRIPTS HERE */
        /*
        Stylesheet Example:
                wp_deregister_style('stylesheet-slug');
        Script Example:
                wp_deregister_script('script-slug');
        */

        /* ---------------------------------------------------------*/
        /* INITIALIZE THEME */
        /* ---------------------------------------------------------*/

        /* OPTION TREE */
        // require get_template_directory() . '/theme-core/theme-optiontree-loader.php';
        // NOW LOADED FROM CORE

        /* THEME LAYOUT VARIABLES */
        require get_template_directory() . '/theme-core/theme-layout-variables.php';

        /* THEME PLUGINS */
        require get_template_directory() . '/theme-core/theme-plugin-loader.php';

        /* THEME STYLESHEETS */
        require get_template_directory() . '/theme-core/theme-register-stylesheets.php';

        /* THEME SCRIPTS */
        require get_template_directory() . '/theme-core/theme-register-scripts.php';

        /* THEME MENUS */
        require get_template_directory() . '/theme-core/theme-register-menus.php';
        /* THEME SIDEBARS */
        require get_template_directory() . '/theme-core/theme-register-sidebars.php';

        function mythology_style_embed(){
                get_template_part( 'theme-core/ot', 'user-styles' );
                }
        add_action('wp_head', 'mythology_style_embed');

        /* DEREGISTER MQs */
        add_action('wp_enqueue_scripts', 'responsive_toggle');
        function responsive_toggle(){
                if(ot_get_option('responsive_toggle') == "off" ) :
                wp_deregister_style( 'theme-media-queries' );
                        wp_deregister_style( 'media-queries' );
                endif;
        }

        /* ---------------------------------------------------------*/
        /* THEME SUPPORT DECLARATIONS */
        /* ---------------------------------------------------------*/

        /* WOOCOMMERCE */
        /* add_theme_support( 'woocommerce' );
                remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
                remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);

                add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
                add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);

                function my_theme_wrapper_start() {
                  echo '<main id="main" class="site-main" role="main">';
                }

                function my_theme_wrapper_end() {
                  echo '</main>';
                } */

        /* Post Formats & Automatic feed links */
        add_theme_support( 'automatic-feed-links' );

        /* Post Thumbnail Support */
        add_theme_support( 'post-thumbnails' );
        set_post_thumbnail_size( 960, 450, true );
        add_image_size( 'slim', 1280, 300, true );

        /* Add shortcode support in widgets */
        add_filter('widget_text', 'do_shortcode');

        // Enable support for Post Formats.
        // add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );

        /**
         * Add theme support for Infinite Scroll.
         * See: http://jetpack.me/support/infinite-scroll/
         */
        /*
        add_theme_support( 'infinite-scroll', array(
                'container' => 'main',
                'footer'    => 'page',
        ) );
        */

        // Setup the WordPress core custom background feature.
        // add_theme_support( 'custom-background', apply_filters( 'mythology_custom_background_args', array(
        //      'default-image' => '',
        // ) ) );

        /* Remove some theme customizer default fields */
        function mythology_customize_register($wp_customize){
          $wp_customize->remove_section( 'colors');
          $wp_customize->remove_section( 'nav');
          $wp_customize->remove_section( 'static_front_page');
        }
        add_action( 'customize_register', 'mythology_customize_register' );


        // CUSTOM FOOTER FUNCTIONS & SCRIPTS
        function mythology_footer() { ?>


                <?php // START CUSTOM JQUERY OPTIONS
                // ADD IN SCRIPTS/RULES BASED ON USER SELECTED THEME & PAGE OPTIONS

                // Activate niceScroll (or not) based on user's preferences in the Theme Options.

                if (ot_get_option("niceScroll") == 'off') : ?>

                        <style type='text/css'>
                                html{overflow-y: auto !important;}
                                body{overflow:auto !important;}
                                .content_background{height: 9999% !important;}
                                #section-header{position: fixed;}
                                #section-content {margin-top: 7.3rem;}

                                #primary, #secondary {
                                    height: auto !important;
                                    overflow: hidden !important;
                                }
                        </style>

                <?php else : ?>

                        <script type='text/javascript'>
                        jQuery(document).ready(function($) {

                                /*-----------------------------------------------------------------------------------*/
                                /* niceScroll
                                /*-----------------------------------------------------------------------------------*/
                                $(".standard #main, #main-secondary").css("height", "100%");
                            $(".post-grid #main").css("height", "100%");

                            $(".standard #main, .standard #main-secondary").niceScroll({
                                cursorcolor:"rgba(155,155,155,0.2)",
                                cursoropacitymin:"0.2",
                                cursorfixedheight:"150",
                                hidecursordelay:"500",
                                cursordragontouch:"true",
                                horizrailenabled:"false"
                                });

                            $(".post-grid #main").niceScroll({
                                cursorcolor:"rgba(155,155,155,0.0)",
                                cursoropacitymin:"0.0",
                                cursorfixedheight:"150",
                                hidecursordelay:"500",
                                horizrailenabled:"false"
                                });

                        });
                        </script>

                <?php endif; ?>

                <?php // LIGHTBOX: IMAGES
                if(ot_get_option('lightbox_images') == "on" ) : ?>
                        <script type='text/javascript'>
                        jQuery(document).ready(function($) {
                                $('a[href*=".jpg"]').prettyPhoto();
                                $('a[href*=".png"]').prettyPhoto();
                                $('a[href*=".gif"]').prettyPhoto();
                        });
                        </script>
                <?php endif; ?>

                <?php // LIGHTBOX: VIDEOS
                if(ot_get_option('lightbox_videos') == "on" ) : ?>
                        <script type='text/javascript'>
                        jQuery(document).ready(function($) {
                                $('a[href*="vimeo"]').prettyPhoto();
                                $('a[href*="youtu"]').prettyPhoto();
                        });
                        </script>
                <?php endif; ?>


        <? }
        add_filter('wp_footer', 'mythology_footer');

}
endif; // mythology_setup
add_action( 'after_setup_theme', 'mythology_setup' );

0 个答案:

没有答案