2

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?

1

1 Answer 1

0

I solved it myself with:

$meta_description = $active->params->get('menu-meta_description'); 

Here are some relevant/supporting references:

1
  • Your answer was flagged by the system for being low quality due to its length. I have edited your answer to include some useful references. It is great that you were able to self-solve and that you shared your solution with the Joomla community. In the future, please offer a bit more insight in your answers if possible. Providing an explanation of how/why your solution works and/or supporting resources will make your contributions much more valuable to future researchers. Thanks for sharing. Please take the tour. Commented Dec 23, 2019 at 20:45

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.