网站搜索不起作用 - 解析错误:语法错误,意外'=',期待')'[重复]

This question already has an answer here:

I am having trouble fixing the search feature on my site.

I get an error that says "Parse error: syntax error, unexpected '=', expecting ')' in /wp-content/themes/freetheme/content-excerpt.php on line 124"

I have looked for line 24 and found this function

        if (!empty($dt = theme_get_date())) {
            ?>
            <div class="date_posted_block">
                <span class="date_posted">
                    <?php echo wp_kses_data($dt); ?>
                </span>
            </div>
</div>

Looks like you have for the right line. The assignment syntax inside the empty() appears not to be valid.

I tested as follows:

function foo() {}
if( empty( $bar = foo() ) ) { 
   echo "empty"; 
} else { 
   echo "not empty"; 
}

and got the same error. What this means is you need to change

if (!empty($dt = theme_get_date())) {

to

$dt = theme_get_date();
if (!empty($dt)) {