Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development Building Out WordPress Navigation The wp_nav_menu Function

Jordan Cox
Jordan Cox
8,930 Points

Menu not toggling after changing foundation.js -> foundation.min. Other questions, different issue.

I looked at all other relevant questions. I believe this is broken down into 2 parts potentially.

1: Strange Issue that I have which is completely separate to any of the lesson and no-one else seems to have reported it.

I have this warning at the top of my site: Warning: preg_match() expects parameter 2 to be string, array given in C:\xampp\htdocs\localwp.com\wp-includes\class.wp-scripts.php on line 151

Warning: strpos() expects parameter 1 to be string, array given in C:\xampp\htdocs\localwp.com\wp-includes\class.wp-scripts.php on line 151

Warning: preg_match() expects parameter 2 to be string, array given in C:\xampp\htdocs\localwp.com\wp-includes\class.wp-scripts.php on line 151

Warning: strpos() expects parameter 1 to be string, array given in C:\xampp\htdocs\localwp.com\wp-includes\class.wp-scripts.php on line 151

Now, we have not touched or looked at any of those files, but I opened it to look at line 151

if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && 0 === strpos( $src, $this->content_url ) ) ) { $src = $this->base_url . $src; }

So, naturally, I tried changing it to:

if ( ! preg_match( '|^(https?:)?//|', '$src' ) && ! ( $this->content_url && 0 === strpos( '$src', $this->content_url ) ) ) { $src = $this->base_url . $src; }

The warnings have now gone, but I don't think this is correct?

In addition, the menu doesn't work regardless of changing the above.

MAIN ISSUE:

Followed all the steps religiously, does not appear to be any errors or mistakes in my code, everything else working perfectly. (I noticed other people with spelling mistakes / syntax missing etc...)

However, the menu does not work. In the console I get the error that it's failing to load: http://localhost/localwp.comArray?ver=1

Looking in the sources, I see the line highlighted: <script type='text/javascript' src='http://localhost/localwp.comArray?ver=1'></script>

It appears on line 34 (is also duplicated on line 35??)

I have checked my siteURL in both WP Settings and Database phpMyAdmin and both point correctly to localhost/localwp.com

At a loss and a bit frustrated, been searching by myself for a couple of hours on the web, but not getting anywhere! Have also changed a few things (app.js) as per other users suggestions, but to no avail and I feel like I'm maybe just making things worse without being able to easily put them back! Any help much obliged and welcome :)

Thanks in advance!

PS: Of course, it could be (most likely) a spelling/syntax error from me that I'm being blind too, but I don't think so, so if you need to see a specific section of code, please ask so I don't post everything here and waste everyone's time looking through every line!

Thanks again!

1 Answer

You might shoot Zac Gordon an email?