Parse error: syntax error, unexpected '<' in functions.php

I know this is a somewhat common error but I"m not sure what's wrong with my code. I get the error Parse error: syntax error, unexpected '<' in /home/content/56/11192256/html/wp-content/themes/Aggregate/functions.php on line 382

Any help would be really appreciated!

function et_delete_featured_ids_cache(){ 
    if ( false !==get_transient( 'et_featured_post_ids' ) )
        delete_transient('et_featured_post_ids' );
    }
}

if ( ! function_exists( 'et_list_pings' ) ){ 
    function et_list_pings($comment, $args, $depth) { 
        $GLOBALS['comment'] = $comment; ?> 
            <li id="comment-<?php comment_ID(); ?>">
            <?php comment_author_link(); ?> - <?php comment_excerpt(); ?> <?php ?>
    }
} 
?>       

<style type="text/css"> body { color: #<?php echo
esc_html(get_option($shortname.'_color_mainfont')); ?>; }
    #    content-area a { color: #<?php echo
    #esc_html(get_option($shortname.'_color_mainlink')); ?>; }
        ul.nav li a { color: #<?php echo
    esc_html(get_option($shortname.'_color_pagelink')); ?>
    !important; } ul.nav > li.current_page_item > a, ul#top-menu
    > li:hover > a, ul.nav > li.current-cat > a { color: #<?php
    echo
    esc_html(get_option($shortname.'_color_pagelink_active'));
    ?>; } h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a,
    h6 a { color: #<?php echo
    esc_html(get_option($shortname.'_color_headings')); ?>; }

    #    sidebar a { color:#<?php echo
    #esc_html(get_option($shortname.'_color_sidebar_links')); ?>;
    #}
        .footer-widget { color:#<?php echo
    esc_html(get_option($shortname.'_footer_text')); ?> }
    #    footer a, ul#bottom-menu li a { color:#<?php echo
    #esc_html(get_option($shortname.'_color_footerlinks')); ?> }
    </style>

<?php }

看起来你错过了{ in

function et_delete_featured_ids_cache(){ 
    if ( false !==get_transient( 'et_featured_post_ids' ) ) {
    //                                                      ^ Here
        delete_transient('et_featured_post_ids' );
    }
}

Problem is

//HERE-------------------------------------------------V
if ( false !==get_transient( 'et_featured_post_ids' ) ){
    delete_transient('et_featured_post_ids' );
}

The block that defines the if is missing a opening curly brace.

To avoid these kinds of problems please use a php syntax aware editor. I found this error by simply pasting your code into the IDE and seeing where it showed the error.

There is a list of freely available ones here


Apart from the already mentioned missing bracket, this is also not going to work and lead to parse errors:

#    sidebar a { color:#<?php echo
#esc_html(get_option($shortname.'_color_sidebar_links')); ?>;
#}

You may have commented out some lines, but the php will run and error out.

链接地址: http://www.djcxy.com/p/69440.html

上一篇: 解析错误:语法错误,意外的T

下一篇: 解析错误:语法错误,在functions.php中出现意外的'<'