Get menu-meta_description from menu item

by Francesco   Last Updated May 21, 2020 21:10 PM - source

I need to add meta description inside a component page. That's what I tried:

$menu      = $app->getMenu(); // Load the JMenuSite Object
$active    = $menu->getActive(); // Load the Active Menu Item as an stdClass Object
$meta_description = $active->params->menu-meta_description;
$document->addCustomTag('<meta name="description" content="' . $meta_description . '">');

The result is not what I would expect:

<meta name="description" content="0">

Obviously, my content is different from "0". So, what's wrong in my code?

Answers 1

Related Questions

Menu won't display second level correctly

Updated May 26, 2015 11:04 AM

Get the menu item variable using Jinput

Updated March 27, 2015 05:03 AM

How to change the title tag?

Updated June 05, 2015 22:04 PM

joomla menu item

Updated June 11, 2015 18:04 PM

Add a parameter to "external url" menu item

Updated February 27, 2016 01:04 AM