There is not a clear way to select the read-more link on trimmed text field output for css styling. I don't know if there is a better solution than the attached patch. It simply adds a class of "more-link" to that link.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review

Update status. Thanks for the patch!

One problem with adding a class might be, that it could break people's layout because more-link is quite generic...

tim.plunkett’s picture

Status: Needs review » Needs work
+++ b/sites/all/modules/contrib/views/handlers/views_handler_field.incundefined
@@ -1120,7 +1120,7 @@ If you would like to have the characters %5B and %5D please use the html entity
+        $more_link = l($more_link_text, $more_link_path, array('attributes'=>array('class'=>array('more-link'))));

What about views-more-link?

Also, please include spaces around =>

ditcheva’s picture

Status: Needs work » Needs review
FileSize
627 bytes

I agree about making the class more specific. I need this feature also, so I'm making the required changes.

Thanks!

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

This looks fine!

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Yeah patches!

Committed to 7.x-3.x and 8.x-3.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

John Franklin’s picture

FileSize
695 bytes

For those coming here looking for a D6 patch, the attached patch does the same.

codemode01’s picture

Old thread, but thought I'd share...

(D7)
If you're looking to add a class to the read more "field" added to trimmed text, you can approach it with Display Suite under the Manage Display tab on the content type.

I was using a Display Suite, 2-column layout and wanted to match the read more link color to the rest of my site. I went to the Manage Display tab, opened the settings (gear icon) on the read more "field" and added a "readmore" class to it... saved it and went back to inspect the code - nothing! It wasn't until I assigned a wrapper tag (the "Wrapper" input textarea) that the class was applied, and it was applied to the wrapper.