Solved

Help with javascript issue on navigation, need to create unobtrusive dropdown page changer

Posted on 2014-09-22
5
123 Views
Last Modified: 2014-11-11
Hi trying to implement this solution on http://css-tricks.com/unobtrusive-page-changer/   ...but everytime i add the following code inside my header.php in wordpress site:

<?php
      // FACEBOOK CODE SUGGESTION TO FIX NAV WITH NO JAVASCRIPT
      if (isset($_POST['nav-mobi'])) {
             header("Location: $_POST['nav-mobi']");
      }
?>

It seems to break the entire site...but other code update is fine.  See screenshot.  That's just a screenshot for you to reference how to see that the data is coming in properly from the code on the bottom (see code below). that code on top is supposed to be detecting that the "nav-mobi" variable exists and redirecting the page to that URL

<?php
                                           // FACEBOOK CODE SUGGESTION TO FIX NAV WITH NO JAVASCRIPT
                                           //wp_nav_menu(array( 'theme_location' => 'primary-menu', 'items_wrap' => '<select><option>Menu</option>%3$s</select>', 'walker' => new select_menu_walker() ));
                                           wp_nav_menu(array( 'theme_location' => 'primary-menu', 'items_wrap' => '<form action="" method="post"><select name="nav-mobi"><option>Menu</option>%3$s</select><input type="submit" value="Go"></input></form>', 'walker' => new select_menu_walker() ));
                                     ?>


PLease experts help with this, its the code at top of page that is problematic, and wordpress doesnt like something about it but cannot figure out what....
header-info.jpg
0
Comment
Question by:kasondeneddy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40338103
And if you put that url directly into the browser does it work?

Your code doesn't really make sense - what is the point of the dropdown with just one option?
0
 

Author Comment

by:kasondeneddy
ID: 40338584
Hi,

This is for the menu on mwebantu.com, to understand better take a look at code behind on website.  Its for smaller screens/devices that we are having the issue on.

Regards,

Kasonde
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40339267
Well it seems to be working fine for me.
0
 

Author Comment

by:kasondeneddy
ID: 40434906
Hi experts, been away, fb partner engineers helped resolved this
0
 

Author Closing Comment

by:kasondeneddy
ID: 40434909
Mistake, was actually working
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question