我仍在掌握函数并尝试使用不同的php函数。
我已经创建了一个我想与自定义metabox摘录同步使用的函数。它将基本上清理数据,并确保其长度为150个字符,第一个单词以大写字母开头。
在测试功能时,我的代码非常松散,但我有点不知所措,很抱歉出现了任何简单的错误。
$test\\u摘录只是为了测试它,但目前它没有输出任何内容。
代码如下。
<?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\');