Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
293 views
in Q2A Core by
edited by

I hate when people write with uppercase. Is there a way to transform the question to lower case?

I know I can modified to change it with: strtolower($str);

But I wanedt to know if Q&A already had that feature, some other scrips already have it.

4 Answers

+2 votes
by
selected by
 
Best answer

No, it's not already included. There are a few options:

1. You could write a Javascript that checks whether the question is in all caps and warns the user. You could even prevent form submission with JS if the post is more than say 80% capitals.

2. Do the above in PHP. It would be best to check if it's all capitals first, and if so, lower case it. That way regular titles can be capitalized in the correct way. You could do the following the capitalize the first letter:

$str = strtolower($str);
$str[0] = strtoupper($str[0]);

Or use the ucwords function on the entire string, To Make Each Word Capitalized Like This.

0 votes
by
Well, is hard to make it automatic, because or you make all characters lower case, or you don't change them. Is bad when people write everything uppercase, but can't you simply edit their message? :)
0 votes
by

You can use css text-transform property, however first letter will also be in lower case. http://www.w3schools.com/Css/pr_text_text-transform.asp

by
But that still puts the capitalized question in the title tag and other places. Using CSS is a poor band-aid.
+1 vote
by
Hi William

The best way to do this would be to alter the style sheet instead of having the server do extra work with PhP script.

Go to your theme folder and open qa-styles.css then search or add the following:

.entry-content {text-transform:lowercase;}

if .entry-content already exists in your qa-styles.css file you can just append:
text-transform:lowercase;
somewhere between the {}.

Other style classes are:
text-transform:uppercase; (this makes everything uppercase)
text-transform:capitalize; (this makes the first letter of each word uppercase, and the rest lowercase)
...