Skip Navigation

[Resolved] Limit the number of characters/words displayed in a field in a view

This support ticket is created 3 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 3 years ago.

Assisted by: Minesh.

Author
Posts
#2247623

I've created a view that pulls information from my custom post type Resources. In the view ouptut, I've created tiles to display individual resources, and added a field to display the title of the resource within the tile.

The problem is that some of my resource titles are very long. Is there any way (from within the field block) to limit the display of the resource title and append it with an ellipse ("...") to indicate there is more to the title.

Here is an example of a site with the feature I'm describing:
hidden link??state=past

I know that someone else asked this question in June 2019 - I was just wondering if Toolset had added this as a feature by now. The recommendation in 2019 was to use CSS text-overflow and limit the physical dimensions, but I'm not sure this would even work in my case as I do want word-wrap until word count is reached.

This is the page where I would implement:
hidden link

Currently I've manually shortened titles in the Resource, so you aren't seeing how it works when the title is too long. It makes the tile longer than all the surrounding tiles.

Thanks,
Amy

#2248639

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no such feature implemented yet to reduce the title length.

The only possible workaround other than the CSS is you will have to write custom shortcode where you should pass the number of words and the shortcode should return you the title after counting the number of words you define.

Please check the following related ticket that should help you:
=> https://toolset.com/forums/topic/how-to-display-a-post-title-with-a-maximun-length-character-limit/

You can adjust the code as required.

More info:
- https://toolset.com/documentation/programmer-reference/adding-custom-code/how-to-create-a-custom-shortcode/
- https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/