致命错误:未捕获错误:已达到‘5000’的最大函数嵌套级别

时间:2021-10-23 作者:Tanvir

我在编码时遇到了一个问题。试图发展一个主题。但屏幕上显示的错误与附带的屏幕截图一样。代码附于此处。有人能帮我吗?

enter image description here

in functions.php

<?php

function launcher_setup_theme(){
    load_theme_textdomain(\'launcher\');
    add_theme_support(\'post-thumbnail\');
    add_theme_support(\'title-tag\');
}

add_action(\'after_setup_theme\',\'launcher_setup_theme\');

function launcher_assets(){
    //**Enqueue CSS */
    wp_enqueue_style(\'launcher\',get_stylesheet_uri());
    wp_enqueue_style(\'animate-css\',get_theme_file_uri(\'/assets/css/animate.css\'));
    wp_enqueue_style(\'bootstrap-css\',get_theme_file_uri(\'/assets/css/bootstrap.css\'));
    wp_enqueue_style(\'bootstrap-css-map\',get_theme_file_uri(\'/assets/css/style.css\'));
    wp_enqueue_style(\'icomoon-css\'.get_theme_file_uri(\'/assets/css/icomoon.css\'));



    //** Enqueue JS */
    wp_enqueue_scripts(\'easing-jquery-js\',get_theme_file_uri(\'/assets/js/jquery.easing.1.3.js\'),
    array(\'jquery\'),null,true);
    wp_enqueue_scripts(\'waypoints-jquery-js\',get_theme_file_uri(\'/assets/js/jquery.waypoints.min.js\'),array(\'jquery\'),null,true);
    wp_enqueue_scripts(\'bootstrap-jquery-js\',get_theme_file_uri(\'/assets/js/bootstrap.min.js\'),array(\'jquery\'),null,true);
    wp_enqueue_scripts(\'countdown-jquery-js\',get_theme_file_uri(\'/assets/js/simplyCountdown.js\'),array(\'jquery\'),null,true);
    wp_enqueue_scripts(\'main-js\',get_theme_file_uri(\'/assets/js/main.js\'),array(\'jquery\'),null,true);

}

add_action(\'wp_enqueue_scripts\',\'launcher_assets\');




function launcher_sidebars_left(){
    //**
    register_sidebar( array(
        \'name\'          => __( \'Footer Right\', \'launcher\' ),
        \'id\'            => \'footer-right\',
        \'description\'   => __(\'Footer\',\'launcher\'),
        \'before_widget\' => \'<li id="%1$s" class="widget %2$s">\',
        \'after_widget\'  => \'</li>\',
        \'before_title\'  => \'<h2 class="widgettitle">\',
        \'after_title\'   => \'</h2>\',
    ) );
    }
    function launcher_sidebars_right(){

register_sidebar( array(
    \'name\'          => __( \'Footer Left\', \'launcher\' ),
    \'id\'            => \'footer-left\',
    \'description\'   => __(\'Footer\',\'launcher\'),
    \'before_widget\' => \'<li id="%1$s" class="text right widget %2$s">\',
    \'after_widget\'  => \'</li>\',
    \'before_title\'  => \'<h2 class="widgettitle">\',
    \'after_title\'   => \'</h2>\',
) 
    );
}

add_action(\'widgets_init\',\'launcher_sidebars_right\');
add_action(\'widgets_init\',\'launcher_sidebars_left\');

in index.php

<?php 
the_post();
get_header(); ?>

<body>
<div class="fh5co-loader"></div>

<aside id="fh5co-aside" role="sidebar" class="text-center" style="background-image: url(images/img_bg_1_gradient.jpg);">
    <h1 id="fh5co-logo"><a href="<?php echo site_url(); ?>"><?php bloginfo(\'name\'); ?></a></h1>
</aside>

<div id="fh5co-main-content">
    <div class="dt js-dt">
        <div class="dtc js-dtc">
            <div class="simply-countdown-one animate-box" data-animate-effect="fadeInUp"></div>

            <div class="row">
                <div class="col-md-12">
                    <div class="row">
                        <div class="col-lg-7">
                            <div class="fh5co-intro animate-box">
                                <h2><?php the_title(); ?></h2>
                                <?php the_content();  ?>
                        </div>
                        
                        <div class="col-lg-7 animate-box">
                            <form action="#" id="fh5co-subscribe">
                                <div class="form-group">
                                    <input type="text" class="form-control" placeholder="Enter your email">
                                    <input type="submit" value="Send" class="btn btn-primary">
                                    <p class="tip">Please enter your email address for early access.</p>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
                
        </div>
    </div>

    <div id="fh5co-footer">
        <div class="row">
            <div class="col-md-6">


                    <?php 
                    if(is_active_sidebar(\'footer-left\')){
                        dynamic_sidebar(\'footer-left\');
                    }
                    footer-left
                    ?>

            </div>
            <div class="col-md-6 fh5co-copyright">

             
             <?php
                if(is_active_sidebar(\'footer-right\')){
                    dynamic_sidebar(\'footer-right\');
                } 
                
                ?>


            </div>
        </div>
    </div>
    
</div>

<?php get_footer(); ?>  

1 个回复
SO网友:MKlodt

哇,这里有很多我们可以忽略的额外代码和警告,但我认为您可能错过了函数的最开始部分。php代码。如果不是,这就是所讨论的整个代码块,那么您在php代码段的开头缺少一个或多个圆括号。这也是错误有时的含义。

这几乎就像一个无限循环。代码缺少括号或括号,或者两者都缺少,因此,如果不是全部的话,那么大多数错误都是由WP引发的,因为WP希望看到其他东西,要么是开始括号,要么是结束括号,而是在它认为不应该看到的地方找到更多的函数、变量和其他代码。

查看函数的开头。php代码中,我看到的内容中缺少1个开括号。如果这是函数中的所有代码。php,它应该这样开始:

__(( \'Footer Right\', \'launcher\' ), \'id\' => \'footer-right\', \'description\' => __(\'Footer\',\'launcher\'), \'before_widget\' => \'\', \'after_widget\' => \'\', \'before_title\' => \'\', \'after_title\' => \'\', ) );
同样,我猜这不是全部代码,因为开头有2个下划线,通常表示上面还有另一行代码。这只是标准的默认函数吗。上面带有WP的php代码?

相关推荐

Functions are causing errors

我在插件的PHP上声明一个函数。插件在每个帖子的顶部加载代码(帖子布局是插件的名称)。无法在/home/content/08/10290908/html/wp-content/plugins/post-layout/plugin.php(181):eval()\'d code:4)中重新声明vote\\u-up()(之前在/home/content/08/102908/html/wp-content/plugins/post-layout/plugin.php中声明)。php(181):第36行的eval