J3.x

Difference between revisions of "Add article title to read more link"

From Joomla! Documentation

m (update category for auto lang categories)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{review}}
+
<noinclude><languages /></noinclude>
 +
<noinclude>{{Joomla version|version=3.x|comment=<translate><!--T:8-->
 +
series</translate>}}</noinclude>
 +
<translate><!--T:1-->
 +
Some people want to have the article title instead of the '''Read More''' link. To achieve this you can set that in the Article management options.</translate>
  
Some people want to add the article title to the readmore link. To achieve this you can use a [[How_to_override_the_output_from_the_Joomla!_core|template override]].
+
<translate>==Set the Article management Options:== <!--T:4-->
 +
</translate>
 +
<translate><!--T:5-->
 +
# In the Admin, go to '''System'''{{rarr}} '''Global Configuration'''
 +
# In the menu on the left, click: '''Articles''' then go to the Tab '''Articles'''
 +
# Set '''Show "Read More"''' to '''Show'''
 +
# Set '''Show Title with Read More''' to '''Show'''
 +
# You can also set a limit of number of characters in Article Title to show in Read More button.</translate>
  
If they are not already there, in your template folder:
+
<translate>
# Create a new folder called 'html'.
+
==Tips & Tricks== <!--T:9-->
# In that folder you create a folder called 'com_content'.
+
</translate>
# And in that folder you create the folders called "category", "frontpage" and "article"
+
<translate><!--T:10-->
 +
Note that you can also add a custom text instead of the '''Read More''' button in the tabs '''Options''' while editing an article.</translate>
  
Then locate the following files:
+
<noinclude>
*(joomla)/components/com_content/views/category/tmpl/blog_item.php
+
[[Category:Tips and tricks{{#translation:}}]]
*(joomla)/components/com_content/views/featured/tmpl/default_item.php
+
[[Category:Article Management{{#translation:}}]]
*(joomla)/components/com_content/views/article/tmpl/default.php
+
[[Category:FAQ{{#translation:}}]]
 
+
[[Category:Tutorials{{#translation:}}]]
Copy the files to their respective locations in the template's html file:
+
[[Category:Tips and tricks 3.x{{#translation:}}]]
*(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:
 
<source lang='php'>
 
<p class="readmore"><a class="btn" href="<?php echo $link; ?>"> <span class="icon-chevron-right"></span>
 
<?php if (!$params->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; ?>
 
</a></p>
 
</source>
 
 
 
Change the line
 
<source lang='php'>echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');</source>
 
into
 
<source lang='php'>echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE', $this->item->title);</source>
 
 
 
The “Read more” link should now look like this:
 
'''Read more: (Article title)'''
 
 
 
 
 
<noinclude>[[Category:Tips and tricks]]
 
[[Category:Article Management]]
 
[[Category:FAQ]]
 
[[Category:Tutorials]]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 07:54, 2 November 2017

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎Türkçe • ‎eesti • ‎español • ‎français • ‎italiano • ‎Ελληνικά • ‎العربية • ‎中文(台灣)‎
Joomla! 
3.x
series

Some people want to have the article title instead of the Read More link. To achieve this you can set that in the Article management options.

Set the Article management Options:[edit]

  1. In the Admin, go to System   Global Configuration
  2. In the menu on the left, click: Articles then go to the Tab Articles
  3. Set Show "Read More" to Show
  4. Set Show Title with Read More to Show
  5. You can also set a limit of number of characters in Article Title to show in Read More button.

Tips & Tricks[edit]

Note that you can also add a custom text instead of the Read More button in the tabs Options while editing an article.