Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
897 views
in Q2A Core by
On my Q2A website I try to keep the format of all the question titles the same to make it more neat : every 3-letter-word starts with a capital, every title starts with a capital, and all the other words don't (eg. "This is a Title" or "I Love How Neat This is" instead of "this is a title" or "i love how neat this is").

Users don't care though, so is there a way to add a script to adapt the title to this particular format before adding a question?
by
You mean capitalized every first letter of word?
by
Well just adapt the title according to my own code (all words longer than 2 letters are capitalized, the first word too).

3 Answers

0 votes
by
I ended up altering "qa-page-ask.php" right under the "// Process Input " comment.
by
I'd actually like to auto-insert text before a title based on the category because of how we're using certain categories on our site. For instance, if someone enters the question "This feature is having a problem" under the Bugs category, I'd like the title to change to "[BUG] This feature is having a problem". Can you elaborate on what code you wrote to achieve your capitalization?
0 votes
by

Is there a way to do this without altering the source code in qa-including?

In other way, can one alter the post creation process with a plugin?

0 votes
by

Doing this via plugin is definitely possible. If you look at the qa-poll plugin, the question title automatically adds [poll] to the end of the question title if the poll option is selected. This coding resides in the qa-poll-lang-default.php file (dictating what is going to appear after the title) and in the qa-poll-layer.php file, around line 96 starting with "// add post elements". There's a spot for the title that reads:

$this->content['title'] .= ' '.qa_lang('polls/question_title');

question_title is defined as '[poll]' in qa_lang.

I'm sure this could be adapted to suit your needs.

by
This can also be done in an advanced theme. I actually ended up adding this to the Snow theme that I use pretty easily.
...