Modify Read More Button Topic is solved

Everything to do with Joomla! 3.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
naykel
Joomla! Intern
Joomla! Intern
Posts: 50
Joined: Sat Jan 19, 2013 10:04 pm

Modify Read More Button

Post by naykel » Mon Jan 21, 2013 10:55 pm

Hi There,

I want to change the read more button to text only rather that a button. I have search and everything I have founds seems to be on how to change the text only.

I found the code below in the blog_item.php but it does nothing when I change it. in fact I can delete the entire file and it does nothing.

<a class="btn" href="<?php echo $link; ?>"> <i class="icon-chevron-right"></i>
<?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>

What am I missing?

Regards
Nathan

sovainfo
Joomla! Exemplar
Joomla! Exemplar
Posts: 8818
Joined: Sat Oct 01, 2011 7:06 pm

Re: Modify Read More Button

Post by sovainfo » Tue Jan 22, 2013 12:35 am

Perhaps a template override?
Issue with migrating? Include logs/joomla_update.php in your report!
Blank screen? Verify pagesource for HTML code (javascript error)
Installation failing on populating database? Install with set_time_limit(0)
Document your customizations!

naykel
Joomla! Intern
Joomla! Intern
Posts: 50
Joined: Sat Jan 19, 2013 10:04 pm

Re: Modify Read More Button

Post by naykel » Tue Jan 22, 2013 4:54 am

I tried that too. It still did not work.

I found it a bit weird that I could delete the entire blog_item.php and it did nothing. Can you confirm that I am using the correct files to make this modification in the first place.

User avatar
subrat
Joomla! Ace
Joomla! Ace
Posts: 1038
Joined: Sat Jul 08, 2006 7:36 am
Location: India
Contact:

Re: Modify Read More Button

Post by subrat » Tue Jan 22, 2013 6:38 am

which template are you using, can you share a link?
Quality WebDevelopment at http://www.webworkwiz.com
Affordable hosting http://www.vsmhosting.com

naykel
Joomla! Intern
Joomla! Intern
Posts: 50
Joined: Sat Jan 19, 2013 10:04 pm

Re: Modify Read More Button

Post by naykel » Tue Jan 22, 2013 8:40 am

I am only working on my local site.

I am using the protostar template. The file I have tried to modify is blog_item.php I also played around with blog.php but that did not do anything either.

I tried to set up an override by placing my files in mysite/templates/mytemplate/html/com_content/views/.......files

I found it really weird that I could delete both of these files and it did not change a thing to my website.

Thanks and regards
Nathan

sovainfo
Joomla! Exemplar
Joomla! Exemplar
Posts: 8818
Joined: Sat Oct 01, 2011 7:06 pm

Re: Modify Read More Button

Post by sovainfo » Tue Jan 22, 2013 10:39 pm

So, which blog_item.php did you edit? How many are there? What template is the menuitem using? Is that the one you editted?
Issue with migrating? Include logs/joomla_update.php in your report!
Blank screen? Verify pagesource for HTML code (javascript error)
Installation failing on populating database? Install with set_time_limit(0)
Document your customizations!

Endriago
Joomla! Intern
Joomla! Intern
Posts: 56
Joined: Thu Sep 15, 2011 2:55 am
Location: FL, USA
Contact:

Re: Modify Read More Button

Post by Endriago » Sun Sep 01, 2013 4:55 pm

Hi Naykel! This thread is pretty old but I figured I can tell you how I achieved the result you asked about, in case someone else has the same issue (or maybe you still need an answer!):
First I have to say that the blog_item.php you need to override is the one located at:
root\website-name\components\com_content\views\category\tmpl\
Copy it and paste it on:
root\website-name\templates\your-template\html\com_content\category\

Now locate the following code (around line 59):

Code: Select all

	<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>
Delete it/comment it and modify it as follows:

Code: Select all

<p><ahref="<?php echo $link; ?>">

	<?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>
By removing [p class="readmore"], [a class="btn"] and [span class="icon-chevron-right">] you strip down the link of all the Bootstrap CSS classes and therefore, their styling.

Hope this helps!

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Sun Dec 22, 2013 12:41 pm

I only have:
root\website-name\templates\your-template\html\
:(
I don't have:
\com_content\category\

What I have to do?

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Sun Dec 22, 2013 2:14 pm

I don't have links on "Read more", now...

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 24745
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: Modify Read More Button

Post by Per Yngve Berg » Sun Dec 22, 2013 3:11 pm

silu wrote:I only have:
root\website-name\templates\your-template\html\
:(
I don't have:
\com_content\category\

What I have to do?

Create the folders and copy the core files into it.

http://docs.joomla.org/How_to_override_ ... omla!_core

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Sun Dec 22, 2013 4:17 pm

Thank you for the answer, Per Yngve Berg! I did, but now I don't have link on "Read more" text...

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Mon Dec 23, 2013 1:34 pm

What I'm doing wrong?

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Thu Dec 26, 2013 7:16 pm

Anybody here? :)
Merry Christmas!

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Wed Jan 01, 2014 9:27 pm

Help? :)

knalim
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 143
Joined: Wed Jan 01, 2014 11:39 pm
Location: SLOVAKIA
Contact:

Re: Modify Read More Button

Post by knalim » Fri Jan 03, 2014 8:29 pm

Waiting for answer too. I would like to change read more button too.

Happy new year :)
Joomla amateur but Enthusiast and Lover :)
Attendant of J and Beyond 2015 in Prague
Im beekeeper, I love honey and bees :) http://www.medaren.sk

Rajoz
Joomla! Apprentice
Joomla! Apprentice
Posts: 39
Joined: Wed Feb 02, 2011 7:52 pm
Location: Annecy, France

Re: Modify Read More Button

Post by Rajoz » Sat Jan 04, 2014 4:36 pm

Hi,

There is a typo (space missing between a and href) on the line

Code: Select all

<p><ahref="<?php echo $link; ?>">
correct syntax is

Code: Select all

<p><a href="<?php echo $link; ?>">
Happy new year,
Rajoz

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Sat Jan 04, 2014 5:07 pm

Many Thanks!!! :)
Happy New Year, Rajoz!

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Sat Jan 04, 2014 7:45 pm

How I can move "Read More" to the right side?
I have searched, but nothing to help me... for Joomla! 3

Rajoz
Joomla! Apprentice
Joomla! Apprentice
Posts: 39
Joined: Wed Feb 02, 2011 7:52 pm
Location: Annecy, France

Re: Modify Read More Button

Post by Rajoz » Sun Jan 05, 2014 9:52 am

Hi Silu,

To move the Read More to the right you can use the Bootstrap class "pull-right" (Protostar is based on Bootstrap).

The line 59 of the override of blog_item.php was initially:

Code: Select all

<p class="readmore"><a class="btn" href="<?php echo $link; ?>"> <span class="icon-chevron-right"></span>
Modifications on this line are now:
  • 1. remove the chevron-right icon: <span class="icon-chevron-right"></span>
  • 2. remove the button aspect: class="btn"
  • 3. add the move to the right: <p class="readmore pull-right">
So, the result for this line is now:

Code: Select all

<p class="readmore pull-right"><a href="<?php echo $link; ?>">
Regards,
Rajoz

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Mon Jan 06, 2014 6:24 pm

Cool and clear! :)
Thank you!

emuath
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Jan 02, 2014 6:15 pm

Re: Modify Read More Button

Post by emuath » Thu Jan 30, 2014 2:06 pm

Does this override work with Joomla 3.2?
Have also installed k2, which I only use for one category, the rest of the site it built with Joomla and the read more buttons are sitting on a Joomla blog category.
Would installing k2 affect plain joomla overrides?

I have made changes as shown below but see no change the Read more link is still in a bootstrap button.

I already have a working template override in my html folder for blog_item.php @
root\website-name\templates\your-template\html\com_content\category\blog_item.php

Have changed code
FROM

Code: Select all

<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>
To

Code: Select all

<p class="readmore pull-right"><a href="<?php echo $link; ?>">

	<?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>

silu
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Mon Oct 21, 2013 5:14 pm

Re: Modify Read More Button

Post by silu » Tue Feb 18, 2014 10:27 pm

Why when I have a multilingual website does not work? Thanks!

taylortwisun
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Jul 17, 2016 9:01 am

Re: Modify Read More Button

Post by taylortwisun » Sun Jul 17, 2016 9:07 am

Bro, so what about changing the title of article next to the button "Readmore"?
and how to modify Readmore--> Continue or etc???
Help me plz! :'( :'( :'(

Wunja
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Jun 27, 2017 10:57 am

Re: Modify Read More Button

Post by Wunja » Tue Jun 27, 2017 11:08 am

Hello, I'm working with version 3.6 and instead of the code shown above, I'm seeing the following

Code: Select all

<?php if ($params->get('show_readmore') && $this->item->readmore) :
	if ($params->get('access-view')) :
		$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
	else :
		$menu = JFactory::getApplication()->getMenu();
		$active = $menu->getActive();
		$itemId = $active->id;
		$link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));
		$link->setVar('return', base64_encode(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)));
	endif; ?>

	<?php echo JLayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>

<?php endif; ?>
This seems a very different way of doing the "Read more" button and I have no idea where to start modifying it. Your help would be much appreciated.

User avatar
toivo
Joomla! Exemplar
Joomla! Exemplar
Posts: 9718
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK
Contact:

Re: Modify Read More Button

Post by toivo » Tue Jun 27, 2017 12:03 pm

The same code is also in the latest version, 3.7.2. More importantly, you should upgrade your site to the latest version where a number of security issues have been fixed.
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
troubleshooting smtp and other articles https://talikka.com/joomla

rimvydukas
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Tue Apr 19, 2011 5:26 am

Re: Modify Read More Button

Post by rimvydukas » Wed Aug 01, 2018 6:42 am

So does anyone know how to do this in the latest Joomla versions with this changed code???

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 24745
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: Modify Read More Button

Post by Per Yngve Berg » Wed Aug 01, 2018 3:04 pm

You can change the text on the button with a Language Override

Extensions->Languages->Overrides

rimvydukas
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Tue Apr 19, 2011 5:26 am

Re: Modify Read More Button

Post by rimvydukas » Fri Aug 03, 2018 9:27 am

Per Yngve Berg wrote:
Wed Aug 01, 2018 3:04 pm
You can change the text on the button with a Language Override

Extensions->Languages->Overrides
Hi,

I don't want to change the text. I want to leave only text link and remove button. But it seems I was able to find out how to do that by creating override for readmore.php file.

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 5521
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Modify Read More Button

Post by sozzled » Fri Aug 03, 2018 10:12 am

I realise that I'm responding to a series of necro-posts; this topic was created 5½ years ago and this has almost nothing to do with Joomla.

The "problem" is that people do not understand the difference between what is plain text and what looks like a button. Most buttons that people see on websites are just text with some CSS applied to it to make the text appear button-like.

The read more "button" is not a button. The read more link is just text with a CSS class attached to it. You can change the appearance of the button by changing the CSS.

This "problem" does not require creating a template override; that's a very complicated way to "solve" the "problem".

@forum moderators: please lock this topic to prevent the temptation for further necro-post abuse. If people want help with how to "modify the read more 'button'" they can create a new topic for those questions.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

rimvydukas
Joomla! Apprentice
Joomla! Apprentice
Posts: 24
Joined: Tue Apr 19, 2011 5:26 am

Re: Modify Read More Button

Post by rimvydukas » Fri Aug 03, 2018 11:37 am

sozzled wrote:
Fri Aug 03, 2018 10:12 am
The "problem" is that people do not understand the difference between what is plain text and what looks like a button. Most buttons that people see on websites are just text with some CSS applied to it to make the text appear button-like.

The read more "button" is not a button. The read more link is just text with a CSS class attached to it. You can change the appearance of the button by changing the CSS.

This "problem" does not require creating a template override; that's a very complicated way to "solve" the "problem".

@forum moderators: please lock this topic to prevent the temptation for further necro-post abuse. If people want help with how to "modify the read more 'button'" they can create a new topic for those questions.
Yes, I agree that this "button" is created with the use of css. So because of that I created readmore.php override and changed btn css class to my own defined css class in this file:) And it was enough to get rid of this "button" :)


Post Reply

Return to “Templates for Joomla! 3.x”