Parse error: syntax error, unexpected 'endif' (T_ENDIF), when trying to view post-Collection of common programming errors


  • halfer

    I have just installed a new wordpress theme and while viewing a single post I get the following error:

    Parse error: syntax error, unexpected 'endif' (T_ENDIF) in
    C:\xampp\htdocs\wordpress\wp-content\themes\amzola\loop-single.php on line 313
    

    The error indicates there is an unexpected endif statement on line 313 of the file loop-single.php.

    I notice on line 272 this theme’s code declares:

    $orig_post = $post;
    $global $post;
    

    and later reverts the variable with:

    $post = $orig_post;    
    

    This seems incorrect, as $post will be NULL before it is globalized, therefore this logic will essentially empty the WordPress $post variable. Is it possible this action is causing a PHP error before the endif statement, throwing the above error code?

    How can I easily check errors in my WordPress website?

    Here is my php code of loop-single.php of a WordPress theme:

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        
    
                
    
                
    
                    
    
                         
    
                    
    
                
    
                
    
                    
    
                        
    
                    
    
                
    
                  
    
                
    
            
    
            
    
                
    
                      
    
                     -  )