Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Passing wp_nav to jquery lavalamp?

Featured Replies

Is anyone familiar with jquery lavalamp? Trying to call the lavalamp function, but instead of passing a ul list to it, would like to be able to use a wordpress nav menu. The point is to make a more user friendly theme with the ability to adjust the menu from the wp admin interface for menus, rather than programatically changing the ul list...

$(function() {
	$("#mainMenu ul").lavaLamp({
		fx: "backout",
		speed: 700,
		click: function(event, menuItem) {
	return true;
	}

  • Author

As a WordPress menu outputs an unordered list, I can't really see where your problem is.

Here is what I've attempted:

<ul class="lavaLamp">
<?php
if (is_home()) {
 $addclass = ' class="current"';
 } else {
 $addclass = '';
 }
echo "<li" . $addclass . "><a href='" . get_option('home') . "' title='Home'><span>Home</span></a></li>";
/*echo listPages();*/
echo wp_nav_menu(array('theme_location'=>'primary-menu')); ?>
</ul>

Seems to work fine using

echo listPages();

, but I want to use the custom nav menu instead of just belching out every page to the menu. The

echo wp_nav_menu(array('theme_location'=>'primary-menu'));

doesn't work, the menu only displays 'Home'.

  • Author

That's because you're not using wp_nav_menu right.

 

Just call it, don't echo it. Also, strip out the hard-coded "home" link and use a home link in the menu itself.

 

Thanks, but your suggestions weren't what I was looking for. I was hoping to find, as I stated originally, someone familiar with both WP and jquery lavaLamp. Turns out you have to create a custom walker to strip the li info from the wp_nav_menu in order to pass it off properly to the lavaLamp function.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.