-1

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>

1 Answers1

1

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)) {
Adam
  • 6,539
  • 3
  • 39
  • 65
  • Thank you for your answer This is what I get after amending the code as you suggested: Parse error: syntax error, unexpected 'if' (T_IF) – Bara Tanich Feb 11 '18 at 14:37
  • Sorry. Missed The semi-colon after the first line. Will edit the answer – Adam Feb 11 '18 at 18:55