Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.8k views
in Q2A Core by
I have to change the order of some elements of the ask page.

With advanced themes it does not seem to be possible (?) to overwrite the qa-page-ask.php

Can somebody propose a solution, if not I have to use a jquery workaround again...
by
What do you need to change? It's probably possible using a theme and/or plugins.
by
"possible to overwrite the qa-page-ask.php" -> In qa-page-ask.php there is no function that I can overwrite. The output is from line 138.

I would like to know how to change the order of the fields in $qa_content['form']. First I need the $custom, and just then the 'title'.
by
I'm looking for a way to do this as well...
by
I was able to change the order by moving the fields of the array, from line 158 in qa-page-ask.php. However, this is a core hack and will be lost after updating.

1 Answer

+5 votes
by
selected by
 
Best answer

Use your advanced theme to override the form_fields(...) function.

In your function, check ($this->template=='ask'). If so, you want to reorder some elements of $form['fields'] before calling through to the default function. You can do this reordering by repeatedly putting an element to the end. Something like this to move the title field to the end:

if (isset($fields['title'])) {
  $temp=$fields['title'];
  unset($fields['title']);
  $fields['title']=$temp;
}

by
wonderful, so I don't have to hack the core :)
by
Can i use it in qa-theme.php ? Where can i find isset($fields['title'] so i can reorder elements ?
...