Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1335432

    Hi Guys,
    How can I adjust the excerpt length in enfold.
    I looked for this code in your artilce:
    https://kriesi.at/support/topic/blog-post-excerpts-2/?login_error#post-169503
    but could not find the exact match?
    $prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( ‘avf_postgrid_excerpt_length’ , 60) , apply_filters( ‘avf_postgrid_excerpt_delimiter’ , ” “), “…”, true, ”);

    Where could I find the right code to change or can I do this more simply in Enfold itself?

    Thanks for your anticipated help:)
    Kevin.

    #1335434

    Hey Kevin,

    Thanks for contacting us!

    Which element are you using? If you are using grid style on Blog Posts element, please add following code to bottom of Functions.php file of your child theme – https://kriesi.at/documentation/enfold/child-theme/

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

    Best regards,
    Yigit

    #1335436

    Hi Yigit
    I already tried that code – in my main functions.php file – but it did not work?
    Any other suggestions?
    Kevin.

    #1335437

    I found this code:
    // 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’);

    on this article:
    https://kriesi.at/support/topic/excerpt-length-and-read-more-blog-post-display/
    But did work – bit I was not sure if this was the best option?
    Kevin.

    #1335438

    Sorry, I meant to say – it did work! However, is this the better option?
    K

    #1335455

    Hey Kevin,

    Which element are you using? The code you posted uses jQuery. I think using filters would be better option.

    If you are using Magazine element, please use following code

    add_filter('avf_magazine_excerpt_length','avf_magazine_excerpt_new_lenght', 10, 1);
    function avf_magazine_excerpt_new_lenght($excerpt) {
    $excerpt = 100;
    return $excerpt;
    }

    If you are using Masonry element, please use following one

    add_filter( 'avf_masonry_excerpt_length', 'masonry_excerpt_length');
    function masonry_excerpt_length() {
    $excerpt = 200;
    return $excerpt;
    }

    And if you are using Accordion element, please use following

    add_filter( 'avf_aviaccordion_excerpt_length', 'slider_excerpt_length');
    function slider_excerpt_length() {
    $excerpt = 200;
    return $excerpt;
    }

    Regards,
    Yigit

    #1335478

    Hi Yigit,
    Yes this is now working on the blog page masonry, with 3 columns.
    However, I wanted it to work on the home page where i have the “latest news” with 4 columns – but I cannot seem to get this working?

    #1335667

    Hi,
    Thank you for your patience it looks like you are using version 4.7.6, please update to v4.8.8 and then check, if it is still not working please include an admin login in the Private Content area so we can investigate.

    Best regards,
    Mike

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.