» » » » » » Joomla: How to change “read more” link with article title

Joomla: How to change “read more” link with article title

posted in: Joomla | 0

Joomla_logo

If you want to change the “Read more” link with the title of the article, you have to override the template.

For this, in your template folder:

  1. Create a new folder called ‘html’.
  2. Within that folder you create a new folder called ‘com_content’.
  3. In the newly created folder you create another folders named “category”, “frontpage” and “article”

Then copy the following files:

  • (joomla)/components/com_content/views/category/tmpl/blog_item.php
  • (joomla)/components/com_content/views/featured/tmpl/default_item.php
  • (joomla)/components/com_content/views/article/tmpl/default.php

to their respective locations in the new template’s html file:

  • (yourtemplate)/html/com_content/category/blog_item.php
  • (yourtemplate)/html/com_content/featured/default_item.php
  • (yourtemplate)/html/com_content/article/default.php

Open these files. Towards the bottom of each of these files you should see something like:

get('access-view')) : echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE'); elseif ($readmore = $this->item->alternative_readmore) : echo $readmore; if ($params->get('show_readmore_title', 0) != 0) : echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit')); endif; elseif ($params->get('show_readmore_title', 0) == 0) : echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE'); else : echo JText::_('COM_CONTENT_READ_MORE'); echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit')); endif; ?>

Change the line

echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');

with

echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE', $this->item->title);

The “Read more” link should now look like this: Read more: (Article title)

Source: joomla.org

Leave a Reply

Your email address will not be published. Required fields are marked *