• I was attempting to edit my functions.php file because I wanted to add a tops header menu.

    I pasted this code into my functions.php

    function top_header_menu() {

    register_nav_menu(‘top-header-menu’,__( ‘Top Header Menu’ ));

    }

    add_action( ‘init’, ‘top_header_menu’ );

    When I updated the file, I got an error message saying

    Parse error: syntax error, unexpected ‘}’ in /home/davidbog/public_html/wp-content/themes/twentyfifteen/functions.php on line 338

    So I deleted the code that I pasted but I’m not sure if I accidentally deleted some code or what and the code sections that I pasted it in between now look like this.

    function twentyfifteen_search_form_modify( $html ) {
    return str_replace( ‘class=”search-submit”‘, ‘class=”search-submit screen-reader-text”‘, $html );
    }
    add_filter( ‘get_search_form’, ‘twentyfifteen_search_form_modify’ );

    This is where I pasted the code

    /**
    * Implement the Custom Header feature.
    *
    * @since Twenty Fifteen 1.0
    */

    The theme I’m using is twenty fifteen and my website is

    https://www.hauteecriture.com

    Thank you to anyone that helps.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    If you re-upload the theme’s functions.php file it will remove the broken code (and any modifications you’ve made).

    This change will require FTP access (access to your website’s files and folders) that can be given to you by your hosting providers.

    In future use a Child Theme: https://codex.www.ads-software.com/Child_Themes

    Thread Starter dboglin01

    (@dboglin01)

    Ok. Thank you so much! I’ve worked for hours in my website and it was almost ready and now this. I’ll go to my hosting service and ask.

    Thread Starter dboglin01

    (@dboglin01)

    Ok so customer service has given me access to my website again but now I have another error message.

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘top_header_menu’ not found or invalid function name in /home/davidbog/public_html/wp-includes/plugin.php on line 503

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try renaming your “plugins” folder (yes the “plugins” one) to “plugins-old”. This will deactivate all of your plugins automatically. Then name it back afterwards. Does the issue persist?

    Thread Starter dboglin01

    (@dboglin01)

    Where do I rename the plugins folder? I’m doing all of this from my dashboard. That’s when I had a problem with my functions.php file. I’m not using a child theme.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Your hosting providers can give you a way to access the files and folders of your website. This is often called “FTP”.

    Thread Starter dboglin01

    (@dboglin01)

    The problem is still persisting.

    Thread Starter dboglin01

    (@dboglin01)

    I’ve also looked in the path and there is no WordPress folder in WordPress-includes. Only in WordPress-content.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Do you also have an unedited Twenty Fourteen theme in your “themes” folder (wp-content/themes) folder?

    Thread Starter dboglin01

    (@dboglin01)

    Yes.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    If you rename the “twentyfifteen” theme folder to something else, WordPress will automatically deactivate it and revert to the Twenty Fourteen theme. Rename the folder back afterwards. Does that resolve the issue?

    Thread Starter dboglin01

    (@dboglin01)

    No. The issue is still there.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I’m out of ideas, sorry! Usually deactivating all of your plugins and switching to a clean default theme rules out any funny business.

    Thread Starter dboglin01

    (@dboglin01)

    Ok. Well where might I find the themes functions.php file so I can reupload it?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    The theme can be found here to download: https://www.ads-software.com/themes/twentyfifteen/

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Help with a syntax error’ is closed to new replies.