Home > WordPress Menubar > Menubar 4.9 is available

Menubar 4.9 is available

October 12th, 2010 andrea

Menubar 4.9 enhances the PHP item type, allowing you to create a menu item and dynamically generate both the link label and the link destination URL.

The PHP item type was introduced in Menubar 4.8, but you could dinamically generate only the link destination, while the link label was specified statically in the Name field.

Now you can enter in the PHP code field any PHP code returning an array with your dynamically generated label and URL; you may also return an empty value, and in this case Menubar will generate no menu item at all.

A sample of the PHP code you can insert in the PHP code field is as follows:

// content of the PHP code field

$someurl = some expression;
$otherurl = other expression;

if (some-condition)
return array ('somelabel', $someurl);
else if (other-condition)
return array ('otherlabel', $otherurl);
else
return false;

This PHP snippet generates:

a) a menu item labeled ‘somelabel’ and pointing to $someurl if (some-condition) is met;
b) a menu item labeled ‘otherlabel’ and pointing to $otherurl if (other-condition) is met;
c) no menu item otherwise.

Menubar 4.9 also fixes a bug that prevented highlighting in an External or PHP menu item type, when the page URL contained a querystring.

Thank you for your support of Menubar!

Categories: WordPress Menubar
Comments are closed.