Is there a php function to insert in the template which prints the name of the menu item of the displayed page?
1 Answer
In this case, the name of the menu item is called "Page Heading" in the Joomla! backend, first you need to have is this option enabled .
Go to the Global Configuration > Menus > and change "Show Page Heading" to "Yes"
You also have this option into your menu items, in the tab called "Page Display", by default is enabled.
So, the code is generated by com_content, and here is the code:
<?php if ($this->params->get('show_page_heading')) : ?>
<div class="page-header">
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif; ?>
If you need to add this code, maybe the best optión is create an override for one of the com_content options, once this is done you can find a folder called html inside your template.
Hope this helps.
echo Factory::getApplication()->getMenu()->getActive()->title;