upgrade theme: parse error
Support Area › Forums › Forward › upgrade theme: parse error
- This topic has 3 replies, 2 voices, and was last updated 9 years ago by Bill Robbins.
-
AuthorPosts
-
April 15, 2015 at 17:19 #28972faos1Participant
Bill,
After updating to the latest forward version (from 1.02 to 1.04 I think) the site does not work.
Instead there is an parse error:
Parse error: syntax error, unexpected T_FUNCTION in /home1/nik23/public_html/investment.forum/wp-content/themes/forward/includes/images.php on line 72any idea how it can fixed without reinstalling the site?
rgds
ps I have a full backup
April 15, 2015 at 17:24 #28973Bill RobbinsModeratorIt sounds like the PHP version on the server is too old. WordPress 4.1 required a change to the first video function that we use with video posts.
You can remove this section of the images.php file to keep the error from showing if there’s not a way to update the PHP version on your server:
if ( ! function_exists( 'organizedthemes_get_first_video' ) ) : function organizedthemes_get_first_video() { global $post; if ( $post && $post->post_content ) { global $shortcode_tags; // Make a copy of global shortcode tags - we'll temporarily overwrite it. $theme_shortcode_tags = $shortcode_tags; // The shortcodes we're interested in. $shortcode_tags = array( 'video' => $theme_shortcode_tags['video'], 'embed' => $theme_shortcode_tags['embed'] ); // Get the absurd shortcode regexp. $video_regex = '#' . get_shortcode_regex() . '#i'; // Restore global shortcode tags. $shortcode_tags = $theme_shortcode_tags; $pattern_array = array( $video_regex ); // Get the patterns from the embed object. if ( ! function_exists( '_wp_oembed_get_object' ) ) { include ABSPATH . WPINC . '/class-oembed.php'; } $oembed = _wp_oembed_get_object(); $pattern_array = array_merge( $pattern_array, array_keys( $oembed->providers ) ); // Or all the patterns together. $pattern = '#(' . array_reduce( $pattern_array, function ( $carry, $item ) { if ( strpos( $item, '#' ) === 0 ) { // Assuming '#...#i' regexps. $item = substr( $item, 1, -2 ); } else { // Assuming glob patterns. $item = str_replace( '*', '(.+)', $item ); } return $carry ? $carry . ')|(' . $item : $item; } ) . ')#is'; // Simplistic parse of content line by line. $lines = explode( "\n", $post->post_content ); foreach ( $lines as $line ) { $line = trim( $line ); if ( preg_match( $pattern, $line, $matches ) ) { if ( strpos( $matches[0], '[' ) === 0 ) { $ret = do_shortcode( $matches[0] ); } else { $ret = wp_oembed_get( $matches[0] ); } return $ret; } } } } endif; // organizedthemes_get_first_video
I will probably take this out completely in the 1.0.5 update to the theme. Too many web hosts use hopelessly outdated software.
April 15, 2015 at 17:42 #28974faos1ParticipantYou do a great job Bill, support is excellent.
Yes my php is old and I can not update right now,
yes I removed the above codeand everything works ok now …
April 15, 2015 at 17:44 #28975Bill RobbinsModeratorSorry for the trouble there. I wish WordPress would force the hand of many web hosts and cause them to update to newer versions of php. That would be good for all of us users out there.
If you need anything else, just let me know.
Have a great night,
Bill -
AuthorPosts
- The topic ‘upgrade theme: parse error’ is closed to new replies.