Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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

    #1223315

    There 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.

    #1223318

    Thanks @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 .

    #1223339

    well 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.

    #1223377

    Great @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.

    #1223380

    Hey,

    Thanks for your help @guenni007!

    Regards,
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.