Tagged: post slider
-
AuthorPosts
-
March 9, 2016 at 11:20 pm #595911
How can I limit the character length of the Title (not the excerpt) in the Post Slider or the Magazine shortcode?
March 14, 2016 at 4:50 pm #597846Hi 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,
YigitMarch 14, 2016 at 6:23 pm #597918I tried your suggestion, it does not work for the tile. I need to shorten the title not the excerpt.
March 17, 2016 at 3:34 pm #599621Hi!
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 -
AuthorPosts
- You must be logged in to reply to this topic.