0

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.

1
  • 1
    consider to contact the developer of your theme; the function flatsome_string_limit_words() is theme specific, and the developer might be the best to help with your question.
    – Michael
    Commented Mar 11, 2018 at 23:09

1 Answer 1

1

Are you sure the flatsome_string_limit_words hook exists inside the string_limit_words function?

I think your best option is to override whole post-simple.php template in your child, but even this depends on how is built the parent theme.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.