• Resolved authentictech

    (@authentictech)


    I upgraded Edin theme today to 1.2.9 and got a white screen error. My logs show the error:

    PHP Parse error: syntax error, unexpected '[' in /wp-content/themes/edin/inc/jetpack.php on line 116

    On the line specified the code is:

    return wp_get_attachment_image_src( $post_thumbnail_id, $size )[0];

    I deleted the [0] and everything now seems to be OK.

Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter authentictech

    (@authentictech)

    Thanks for all your help, Kathryn. The code you provided works fine for me.

    Do you foresee a fix for this in the next release of Edin or are we going to have to keep re-editing the code each time the Edin files are updated unless we can upgrade PHP?

    Unfortunately, I don’t have access to a more recent PHP7 release on this shared hosting platform yet (assuming only versions prior to PHP7.1 are affected).

    Can you tell me the technical cause of the problem (so I can perhaps bug my host to upgrade to PHP7.1)?

    Many thanks.

    The code change to the jetback.php file (line 116) in the Edin theme worked for me! Thanks again ??

    Thanks, all. If you’re comfortable doing so, you could try changing the code on line 116 from this:

    return wp_get_attachment_image_src( $post_thumbnail_id, $size )[0];

    to this:

    $attachment = wp_get_attachment_image_src( $post_thumbnail_id, $size ); // Attachment array
    $url = $attachment[0]; // Attachment URL
    return $url;
    That should be compatible even with PHP 5.3.

    Moderator Kathryn Presner

    (@zoonini)

    We’ve just released Edin 1.2.10, which should solve the syntax-error issue in older PHP versions; it should be live shortly.

    If anyone still has an issue after updating to that version, please let me know what version of PHP you’re running. Thanks!

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Syntax error in edin 1.2.9’ is closed to new replies.