0
votes

I want to use article description section (meta description) as a second title in joomla 2.5.x.

And put it in the article next to the headline.

To do this I use the following command.

<?php 

jimport( 'joomla.document.document' );

function getDescription() {
    return $this->description;
}

echo "<h3>".getDescription()."</h3>";

?>

I put it inside the following file but it did not work.

components\com_content\views\article\tmpl\default.php
1
I haven't tested but you might be able to just echo $this->item->metadesc;.Elin
Thank you. I found a another way.$doc =JFactory::getDocument(); $meta_description = $doc->getMetaData("description"); echo "<h3>".$meta_description."</h3>";hhgh4269

1 Answers

0
votes

I am pulling the answer provided by @hhgh4269 out of the comments and into an answer, to help future visitors to this question.

This was done slightly different than the original question proposed. Instead, it was done using this:

$doc =JFactory::getDocument(); 
$meta_description = $doc->getMetaData("description"); 
echo "<h3>".$meta_description."</h3>";