Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #595911

    How can I limit the character length of the Title (not the excerpt) in the Post Slider or the Magazine shortcode?

    #597846

    Hi crawford13!

    Please add following code to Functions.php file in Appearance > Editor and adjust as needed

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

    Best regards,
    Yigit

    #597918

    I tried your suggestion, it does not work for the tile. I need to shorten the title not the excerpt.

    #599621

    Hi!

    Thank you for coming back.

    Currently this is not possible.

    I added 2 filter hooks to the core – hope, kriesi will integrate in the next update.

    To use the hooks add following code to Functions.php file of your child theme (or parent theme, if not using a child theme)- you can use Dashboard -> Appearance > Editor:

    
    add_filter( 'avf_postslider_title', 'my_postslider_title', 10, 2 );
    add_filter( 'avf_magazine_title', 'my_magazine_title', 10, 2 );
    
    function my_postslider_title( $title, $entry )
    		{
    			$title = substr( $title, 0, 15 );      // change 15 to desired length
    			return $title;
    		}
    
    function my_magazine_title( $title, $entry )
    		{
    			$title = substr( $title, 0, 15 );
    			return $title;
    		}
    

    You have to modify core files:

    In enfold\config-templatebuilder\avia-shortcodes\postslider.php line 374 you find:

    
    if($loop_counter == 1) $output .= "<div class='slide-entry-wrap'>";
    

    Replace with:

    
    $title = apply_filters( 'avf_postslider_title', $title, $entry );
    
    if($loop_counter == 1) $output .= "<div class='slide-entry-wrap'>";
    

    In enfold\config-templatebuilder\avia-shortcodes\magazine.php line 529:

    
    $title	 		= "<a href='{$link}' {$titleAttr}>". get_the_title( $entry->ID ) ."</a>";
    

    replace with:

    
    $title	 		= "<a href='{$link}' {$titleAttr}>". apply_filters( 'avf_magazine_title', get_the_title( $entry->ID ), $entry ) ."</a>";
    
    

    Cheers!
    Günter

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