-
AuthorPosts
-
June 17, 2020 at 10:53 am #1223308
Hello I have a question. Is it possible to assign to specific textblocks a limitation to the number of characters that can be written? I know that there are some functions to apply that to a TinyMCE, but I have no idea if I can apply it to a specific id textblock
Thanks
June 17, 2020 at 11:22 am #1223315There are some usefull codes to limit excerpt length ( characters or word count ) but for a normal textblock I can’t think of anything right now for a specific content – f.e. for a given content in a textblock with id or class etc.
June 17, 2020 at 11:27 am #1223318Thanks @Guenni007, I have read about codes to limit excerpt content. I could work it out with a custom ACF field, but I wanted to render everything in the advanced layout builder. The specific page, where I need it, is made by 3 flex columns simply containing title + textblock + image. In order to have everything nicely ordered at the same height, the idea was to, somehow, limit the amount of text the client can add to the textblock. I wonder however (I am not an expert of ACF) if I can use a multiple ACF just on a single page .
June 17, 2020 at 12:30 pm #1223339well i guess the excerpt codes could be transformed to a given selector f.e.:
function limit_character_length(){ ?> <script> (function($){ $(window).load(function(){ $('.av_textblock_section').each(function() { $(".avia_textblock > p").text(function(index, currentText) { return currentText.substr(0, 50); }); }); }); })(jQuery); </script> <?php } add_action('wp_head', 'limit_character_length');
i guess its best to see your site to give better advice.
i think it would be best to have on text editor a character counter.
Unfortunately the word counter has also disappeared when using the Advanced Layout Builder in the Text Editor.June 17, 2020 at 1:35 pm #1223377Great @guenni007, it’s a good compromise! I just put it in the functions.php with a conditional setting on which page the function should be triggered and it works.
June 17, 2020 at 1:42 pm #1223380 -
AuthorPosts
- You must be logged in to reply to this topic.