Created
August 9, 2023 14:23
-
-
Save svenl77/bcf3f659ade9044573879f748e5f1c6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_buddyforms_excerpt_length($length){ | |
global $post, $buddyforms; | |
if( !isset($post->ID) ){ | |
return $length; | |
} | |
// Filter for a specific form | |
$form_slug = get_post_meta($post->ID,'_bf_form_slug', true); | |
if( isset($form_slug ) && $form_slug == 'post'){ | |
return 100; | |
} | |
// Filter for a specific post type. | |
if( $post->post_type == 'post'){ | |
return 50; | |
} | |
return $length; | |
} | |
add_filter('excerpt_length', 'my_buddyforms_excerpt_length'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment