Hi there,
Trying to limit the text shown and saw this post in Toolset Support:
https://toolset.com/forums/topic/limiting-field-length-to-display/
If I'm working to this principle I should be add:
[show_field_with_limit length="140"]
[types field="'property-detail" output="raw"][/types]
[/show_field_with_limit]
But how? No matter what I add this to the code is removed.
Any thoughts ref this would be great, can't even test if this works and if this will be a solution to what we need.
Many thanks, Pete
Hello,
I suggest you try the solution of below thread:
https://toolset.com/forums/topic/cannot-find-field-options-under-the-single-field-setting/#post-1886537
And above custom shortcode is using function mb_strimwidth() to truncate string, this will work in non-English characters:
hidden link
To insert the custom shortcode into Gutenberg editor, please try WordPress built-in "Shortcode" block, see WP document:
https://wordpress.org/support/article/shortcode-block/
Hi there Lou,
Thank you, appreciate the help.
Ok I got this working great following steps 1 and 3 however I didn't understand what I would do ref:
And above custom shortcode is using function mb_strimwidth() to truncate string, this will work in non-English characters:
hidden link
I followed 1 and 3 and used this shortcode: [mb_strim_title length="20"][types field='property-details'][/mb_strim_title]
Should I be using something else?
I have tried it in my localhost with a fresh WP installation, it works fine, if you need more assistance for it, please provide a test site with the same problem, also point out the problem page/post URL, and where I can edit your custom PHP codes, I need a live website to test and debug, thanks
Hi Luo,
Well that was my issue, I used it and it worked fine.
I couldn't work out why you sent:
And above custom shortcode is using function mb_strimwidth() to truncate string, this will work in non-English characters:
hidden link
For the PHP function mb_strimwidth(), please check the PHP document here:
hidden link
And
hidden link
When you manipulate (trim, split, splice, etc.) strings encoded in a multibyte encoding, you need to use special functions since two or more consecutive bytes may represent a single character in such encoding schemes. Otherwise, if you apply a non-multibyte-aware string function to the string, it probably fails to detect the beginning or ending of the multibyte character and ends up with a corrupted garbage string that most likely loses its original meaning.
Hi Luo,
Ok, I don't understand half of what this is. I'm no developer so can we keep this straight forward please.
I'm using this shortcode:
[mb_strim_title length="530"][types field='property-details'][/mb_strim_title]
It works. You said you tested it, and it also works?
Either way I'm just looking for a straight forward way of getting this to work...it seems to be!
You're adding far more, confusing information here that I simply don't understand or need.
I have had to add this to the Fields and Text block as the shortcode block has no ability to add a class or to style the text.
It still works.
Just need to know if this is ok and stable.
Thank you.
You can use a Toolset container block to wrap the shortcode block, and add CSS class names, style it with CSS codes easily:
https://toolset.com/course-lesson/container-blocks/
My issue is resolved now. Thank you!