• Resolved Travellous World

    (@travellous-world)


    I was trying to create a new widget area in WordPress, with the help of this article: https://wpgyan.com/how-to-create-a-widget-area-in-wordpress-theme/#comment-116877

    Unfortunately, something went entirely wrong, and everything I try to do now ends up in an error message, saying: Parse error: syntax error, unexpected ‘<‘ in /home/trave251/public_html/wp-content/themes/christine/functions.php on line 515

    I can’t even access the functions.php area anymore to remove the code I entered. Can please someone help me with this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Chad

    (@lynneandchad)

    You’re going to need to copy your functions.php file onto your hard drive, edit it and re-upload it once it’s fixed.

    This will get you started: https://codex.www.ads-software.com/FTP_Clients

    You should also look into code editing software – there are some decent free options available, just look to Google. Something with syntax highlighting makes tracking down this type of error MUCH easier.

    For future reference, I’m venturing to guess that you copy and pasted the code exactly as it sits on that site. That would explain the error your getting. You shouldn’t have copied the php tag (<?php) but instead copied everything but the opening and closing php tags.

    eg:

    /**
     * Register Widget Area.
     *
     */
    function wpgyan_widgets_init() {
    
    	register_sidebar( array(
    		'name' => 'Header Sidebar',
    		'id' => 'header_sidebar',
    		'before_widget' => '<div>',
    		'after_widget' => '</div>',
    		'before_title' => '<h2 class="rounded">',
    		'after_title' => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'wpgyan_widgets_init' );

    Thread Starter Travellous World

    (@travellous-world)

    Thank you both! The problem has been resolved!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘'Parse error: syntax error'’ is closed to new replies.