Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1100692

    Hi

    I would like same excerpt length on the blog post grid and I have used the following coding however it hides the read more button too :( which I would still like to show, please

    // Excerpt length
    function custom_excerpt(){
    ?>
    <script>
    // trim sentence by 22 words
    function trimByWord(sentence,wordcount = 22) {
    var result = sentence;
    var resultArray = result.split(” “);
    if(resultArray.length > wordcount){
    resultArray = resultArray.slice(0, wordcount);
    result = resultArray.join(” “) + “…”;
    }
    return result;
    }
    jQuery(window).load(function(){
    jQuery(‘.post-entry’).each(function() {
    jQuery(“.entry-content “).text(function(index, currentText) {

    return trimByWord(currentText);
    });
    jQuery(“.entry-title a”).text(function(index, currentText) {
    return trimByWord(currentText,15); // trim title by 15 words
    });
    });
    });
    </script>
    <?php
    }
    add_action(‘wp_head’, ‘custom_excerpt’);

    #1100961

    Hey info224,

    Please share the link to your website too.

    Best regards,
    Victoria

    #1101113

    Hi

    Please find the details below. I have removed the coding at present.

    #1102148

    Hi

    I was wondering if someone could come back to me :)

    Thanks.

    #1102372

    Hi,

    Sorry for the delay. Please remove the previous script and use this filter instead.

    add_filter('avf_postgrid_excerpt_length','avf_postgrid_excerpt_length_mod', 10, 1);
    function avf_postgrid_excerpt_length_mod($length)
    {
       $length = 30;
       return $length;
    }
    

    Default excerpt length value is 60.

    Best regards,
    Ismael

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