I want to change values of the variable in my theme. I don't want to edit in this file because after update theme, it will be lost.
So, I want to update values of this variable in functions.php.
In post-simple.php
file:
<p class="from_the_blog_excerpt small-font show-next">
<?php
$excerpt = get_the_excerpt();
echo flatsome_string_limit_words( $excerpt, 15 );
?>
</p>
I want to change values 15(the length of string)
to another value in the function flatsome_string_limit_words($excerpt, $length)
.
In functions.php
of child theme, I write this code look like:
function custom_excerpt_length( $excerpt, $length ) {
$length = 30;
return $length;
}
add_filter( 'flatsome_string_limit_words', 'custom_excerpt_length', 999 );
I tried to change values of $length
to values 30
instead of 15
like default set on post-simple.php
file.
But it does not a success. It still return $length = 15
.
flatsome_string_limit_words()
is theme specific, and the developer might be the best to help with your question.