• Resolved MBWD

    (@mbwd)


    I’m using twenty twelve, and am attempting to enqueue jquery so that I can experiment with using functions on a test site. The error I’m running into has happened to me nearly every time I’ve played around with jquery.

    I pasted the following code into functions.php:

    add_action( ‘wp_enqueue_script’, ‘load_jquery’ );
    function load_jquery(#slider) {
    wp_enqueue_script( ‘jquery’ );
    }

    I realize that adding the function name #slider where I did was a mistake. But what happens next is that I get this error:

    Parse error: syntax error, unexpected ‘(‘, expecting ‘&’ or T_VARIABLE in /homepages/25/d123900814/htdocs/Sample3/wp-content/themes/twentytwelve/functions.php on line 82

    and I could live with that if it wasn’t for the fact that going back, erasing ALL the above code I pasted into functions.php, and updating the file does not remove the error message. And it breaks the whole site.

    http://sample3.mahonebaywebdesign.com/

    Why doesn’t fixing the mistake in functions.php cause the error to be resolved?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter MBWD

    (@mbwd)

    I should add that the only way I am able to fix this error is by FTPing a whole new version of functions.php into my directory, overwriting the old version. This seems like a bit of a drastic move for a relatively minor error but it’s the only thing I’ve found that works. So my question is really not how to fix it, but why it happens in the first place.

    You are probably introducing an error just before or after your inserted code. Why are you trying to enqueue jQuery? It’s is available by default in WP.

    Thread Starter MBWD

    (@mbwd)

    Googling things like “how to use jquery in WordPress” seems to yield the universal result that the proper way to use jquery is to enqueue it in functions.php. Maybe this is only actually true for those who are developing themes or plugins. I am not trying to do that… I’m just trying to use jquery functions in the default theme. If this is not the case, then how does one use a function like #accordion in twenty twelve, for example?

    Thread Starter MBWD

    (@mbwd)

    I will post a separate request.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Error after editing functions.php that won't go away’ is closed to new replies.