Support » Plugin: ACME Divi Modules » excerpt length

  • Hi,

    Thank you for this great plugin. Especially liked the excerpt function that you added to projects portfolio.

    Just a question, is it possible to limit the excerpt length to a default value? In a way that the text after this set value will be cut off and replaced by “…”

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author acmemediakits

    (@acmemediakits)

    Hi.
    Thank you for using my plugin.
    I’m looking for a js solution to solve your issue, so it can be plugin independent.

    Otherwise, you may build a child function, but it’s not so easy.

    Plugin Author acmemediakits

    (@acmemediakits)

    Here is the js solution:

    Step 1:
    Open the Acme Portfolio Module and add a new class to it called ‘short_excerpt’
    Class Name

    Step 2:
    Add a ‘Code’ module after the Acme Portfolio modulemodules

    Step 3:
    Add this code to your ‘Code’ Module:

    <script>
     jQuery(document).ready(function($) {
     var myExLength=20; //replace this value with custom
     var myStrTermination='...'; //replace this string with custom value
     $('.short_excerpt').find('p').each(function(){
     if(!$(this).hasClass('post-meta')){
     var curTxt=$(this).text();
     var newTxt=curTxt.substr(0,myExLength)+myStrTermination;
     $(this).text(newTxt);
     }
     });
    });
     </script>

    The problem with javascript is that it is rendered after the page has loaded, so you may see the original long text disappear after some seconds.

    In order to avoid this issue you may code inside the php module.

    If you need further support, just drop me a message.
    Take care
    mirko

    Thank you for this! I will give it a try.

    Plugin Author acmemediakits

    (@acmemediakits)

    You may change the values for
    myExLength (now is 20 letters) and
    myStrTermination (now is set to ‘…’)

    Let me know if this solves your issue.
    m

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘excerpt length’ is closed to new replies.