Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By mindprint on
I'm creating a trivia site, and I'm setting up the teaser as the question and the user clicks "read more" to see the answer. But, I don't want it to say "read more". I'd rather it say "answer". I can't find any place to make this change. Could someone point me in the right direction?
Also, has anyone seen a trivia drupal site? I'd love to see an example.
Comments
The recommended way is to
The recommended way is to find the themeable function and modify its output at the theme level.
You can also open node.module with a text editor, search for "read more", and change it to "answer".
http://www.webwiseone.com
It's all about community.
https://bkjdigital.com
We make magic.
Same answer, but with an explanation...
Firstly I would NOT advise changing node.module. This will affect ALL of your nodes!
Look for node.tpl.php in the theme folder you are using under themes.
Copy the file and rename it node-story.tpl.php. NOTE: Replace story with the type of node which you are using for your questions.
Open node-story.tpl.php and look for this line:
Replace it with this code:
Modify 'TEXT TO REPLACE' and 'NEW TEXT' to suit your needs.
I forsee that you will also want to change the text that appears when the pointer is over the link... It is possible to 'nest' str_replace functions as follows:
Upload your modified node-story.tpl.php and hopefully you will have your desired result.
Excellent Explanation
That's an excellent explanation, Sverre!
Thanks for taking the time to spell it out.
Kevin
http://www.webwiseone.com
It's all about community.
https://bkjdigital.com
We make magic.
Thank you. I'll give it a
Thank you. I'll give it a shot.
Unfortunately, it did not
Unfortunately, it did not work. Any other ideas?
Awesome!!! This is what I
Awesome!!!
This is what I need: not modifying node.module or theme engine but just theme templates because that's safer and more flexible. And you can make use of preg_replace to change whatever you want. awesome!
THANKS!
that was a great suggestion, Sverre. Thanks!
Just for reference, I was simply trying to change the "Read More" text because very few users even realize that they're only looking at an excerpt - nobody was clicking them! Especially on the blogs, where it showed "Someone's blog - Read more" so it looked like you'd just be linking to their blog.
editing theme_dir/node.tpl.php and inserting the str_replace(1st_text,2nd_text,$links) instead of just $links is a perfect solutions, thanks. (I was originally looking in excerpt.module, blog.module, I really couldn't locate where "read more" originated from! With this fix, i suppose it doesn't matter)
coupling that with CSS styling (in theme_dir/styles.cs) like the following, really let me customize and make more apparent the previously unused Read More link.
for those who are learning, like me, here's what I did.
fyi, this is for Drupal v4.6.11, so it looks alittle different in the node.tpl.php
node.tpl.php:
style.css:
This makes the whole thing look like a bar between excerpts, with "Read full Article" on left, other links in middle, info/taxonomy on right.
depending on how soon you click, you may be able to see it here:
http://www.SarahHouseSB.org/events
I decided to just alter the
I decided to just alter the node.module. It's okay that it will effect other themes.
Thanks for your help.
Fair enough
Just out of interest, what node type are you using for your questions?
story
story
Locale module
One could also use the locale module, search fro the string and replace it with the text one would have in mind.