Hello,
I need to make my blog searches cropped after 100 characters, please, would you know how to achieve that result ?
I'm sorry to ask, but I'm not fluent yet with php, and as soon as forms are involved, I've got a mental block, I believe :(
My searchform.php is as below, do you see how it could be cropped easily from there ?
<?php if (!is_search()) {
$search_text = "Search The Website";
} else {
$search_text = "$s";
}
?>
<form method="get" id="searchform" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" value="<?php echo wp_specialchars($search_text, 1); ?>" name="s" id="s" onfocus="if (this.value == 'Search The Website') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search The Website';}" />
</form>
I used as source http://us.php.net/substr , but I ended up realizing I wasn't adressing the proper part of the code, it seems :(
Examples not working :
$search_text = "substr('$s', 0, 100)";
$search_text = "$s";
$s = substr($s, 0, 4);
$search_text = "123";
That last example proved me I didn't adress the right part of the code anyway, the "123" text appeared in the text written by default in my search field, and then the blog searched the whole words I was typing inside ¬_¬
I apologize, but I don't see where I must make the edit, as simplistic as it can be :(
Please, would you know what I must change, to have the search query cropped correctly ?
Thank you VERY MUCH if you can help, I'll be grateful ! :)
Sabinou