upgrade theme: parse error

Support Area Forums Forward upgrade theme: parse error

Viewing 4 posts - 1 through 4 (of 4 total)
URL to the page in question: http://investment.forum.iea.org.gr/
  • Author
    Posts
  • #28972
    faos1
    Participant

    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 72

    any idea how it can fixed without reinstalling the site?

    rgds

    ps I have a full backup

    #28973
    Bill Robbins
    Moderator

    It 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.

    #28974
    faos1
    Participant

    You 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 code

    and everything works ok now …

    #28975
    Bill Robbins
    Moderator

    Sorry 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

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘upgrade theme: parse error’ is closed to new replies.