Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1362462

    Hello, i tryed to change the excerpt lenght for a blog view on the front page with this Filter:

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

    But nothing happened. I added the filter to the functions.php of the child theme. Can you plz have a look why the filter is not working?

    Best regards

    Chris

    #1362484

    can you try this instead:
    i think that all these blog views are influenced by postslider.php – and there is that filter

    function custom_post_slider_entry_excerpt( $excerpt, $prepare_excerpt, $read_more, $entry, $obj_post_slider = null ){
      $modify = true;
      if( $modify ){
        $new_excerpt_length = 50;
        $excerpt = substr( $excerpt, 0, $new_excerpt_length ) . $read_more;
      }
      return $excerpt;
    }
    add_filter( 'avf_post_slider_entry_excerpt', 'custom_post_slider_entry_excerpt', 10, 5 );
    #1362491

    Hi Guenni007,

    thanks a lot! That works! one other thign: How can i make the excerpt end with 3 dots?

    Thanks!

    #1362492

    try:

    function custom_post_slider_entry_excerpt( $excerpt, $prepare_excerpt, $read_more, $entry, $obj_post_slider = null ){
      $modify = true;
      if( $modify ){
        $new_excerpt_length = 50;
        $excerpt = substr( $excerpt, 0, $new_excerpt_length ) .  ' …';
      }
      return $excerpt;
    }
    add_filter( 'avf_post_slider_entry_excerpt', 'custom_post_slider_entry_excerpt', 10, 5 );

    Edit : no that will be too easy.

    just a moment …

    #1362495
    function custom_post_slider_entry_excerpt( $excerpt, $prepare_excerpt, $read_more, $entry, $obj_post_slider = null ){
      $modify = true;
      if( $modify ){
        $new_excerpt_length = 150;
        $excerpt = substr( $excerpt, 0, $new_excerpt_length ) . $read_more;
      }
      return $excerpt . '...';
    }
    add_filter( 'avf_post_slider_entry_excerpt', 'custom_post_slider_entry_excerpt', 10, 5 );

    this works :-)

    Thanks for the good support

    • This reply was modified 2 years, 3 months ago by Chris_85.
    • This reply was modified 2 years, 3 months ago by Chris_85.
    #1362498

    Hi,

    We are happy that @guenni007 helped :)


    @guenni007
    thanks for your help as always :)

    Best regards,
    Yigit

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘change excerpt lenght not working.’ is closed to new replies.