Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Java Script broken WordPress


I am running two copies on wordpress on one domain at and

Everything works fine except the theme no longer functions properly. It used to "glide" up and down to the different pages. Also the portfolio "glides" no longer work and the scroll banner at the top disappeared. The theme author says something is breaking the Java Script and I suspect it's the second copy of wordpress...

How can I fix this so that the Java Script works properly on both blogs?

Answers (3)


Christianto answers:

Hi Jason,

Did you use a plugin to include analytic code on your site?

I found that there are backslash before apostrophe (\') on your analytic code that causing error:

var _gaq = _gaq || [];
_gaq.push([\'_setAccount\', \'UA-11317676-1\']);

(function() {
var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'\';
var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);

it should be remove.

Jason Harris comments:

The theme itself has a place for the Google Analytics script to be inserted in the theme settings. I've gone in and removed that to rule that out. No change.

Christianto comments:

I check now the error comes from jquery framework included from wordpress

You could reupload this file to make sure that its not corrupt or change.

Christianto comments:

ignore my last comment, its not jQuery,
one of your jQuery selector use in your site js code is not correct syntax..

I try to check which one causing this..

Christianto comments:

I think I found it..
on your script.js file

about line 49:
// Anchors corresponding to menu items
scrollItems ={
var item = jQuery(jQuery(this).attr("href"));
if (item.length) { return item; }

Change to this
scrollItems ={
var id = jQuery(this).attr("href").split('#')[1],
item = jQuery('#'+id);
if (item.length) { return item; }

Jason Harris comments:

Ah, just saw this. I did this replacement and the problem seems to be solved! Thanks!


asok answers:


You seem to be using a single page theme, which expects the top menu links to start with # tag. Since you added a link for your SHOPPE (the last link) in the menu (class = sf-menu) at the top, its breaking the theme.

In case you do not want to change the js, may be you can try following from admin panel
1) create another menu and place it adjacent to the sf-menu
2) edit 'SHOPPE' link and move it into the new menu.

@christianto got it spot on. Cant up vote him, yet as i am a new user here.

Jason Harris comments:

Hey Asok. Thanks for the response (and to the others).

The shoppe link was actually a page set as a link (part of the theme functionality). I've unpublished the page and the site is working again!

Now I'm just trying to work out how to get that link ( back into the menu without breaking the site. Does that have to be coded in? Where would I find the sf-menu?


asok comments:


Be honest, its little difficult without looking at the admin interface for the theme (since its not freely available for testing) to see if the theme has an option to add widgets to the header section.

1) Try creating a menu by trying the options under Apearance -> Menus
2) Try adding the shoppe page to that menu
3) Try adding the custom menu into top header section by going to Apearance -> Widgets (there is a chance that theme may not support this)

Give it a try, but as you noticed @christianto's solution works perfect.

Jason Harris comments:

Thanks Asok. Yeah, the theme doesn't support header widgets. I've notified the theme developer so hopefully they'll make @Christianoto's change since the theme specifically supports using a page as a link...

Thanks again for your help.


Navjot Singh answers:

Since both are independent WP installations, shoppe site cannot affect the main one. Try disabling each plugins on the main site 1 by 1 and check whether that works. That way you will be able to identify what is causing the conflict.

Jason Harris comments:

Deactivated all plugins. No change.