I'm still getting to grips with functions and experimenting with different php functions.
I've created a function what I want to use in sync with my custom metabox excerpt. It will basically sanitize the data and make sure its 150 characters long and the first word starts with a capital letter.
My code is very loose at the minute as I'm testing the functionality out, But am kind of lost as to how I should go about this, Sorry for any simple mistakes.
the $test_excerpt was just to test it, but at the moment it outputs nothing.
Code is below.
<?php
//Function that trims any access spaces either side of the excerpt incase it fails the validation run
$text_excerpt = "test";
function vs_trim_excerpt($text_excerpt) {
if(isset($text_excerpt)) {
trim($text_excerpt);
ucfirst($text_excerpt);
wordwrap($text_excerpt, 150);
return $test_excerpt();
}
}
vs_trim_excerpt();
?>
add_action('init', 'vs_trim_excerpt');