in Software by (10.8k points) edited by
0 like 0 dislike
1.6k views
How I can to move answer form below current answers on question page in Question2Answer CMS? How to change question page so that answer form move to bottom of page in Question2Answer platform? How to put answer form to end of page? How i enable show answer form immediately always after answers in Q2A CMS?

I go to: Admin panel > "Viewing" tab > "Show answer form immediately" option > set "Always" value. But answer form view after question. I want to see after all answers. How do it?

question2answer answer form bottom

1 Answer

0 like 0 dislike
by (10.8k points) edited by

Add this/below code to your main custom theme php file:

function doctype() {
	qa_html_theme_base::doctype();
	if (isset($this->content['a_form'])) {
		$a_form = $this->content['a_form'];
		unset($this->content['a_form']);
		$this->content['a_form'] = $a_form;
	}
}

or this for generalizations:

function doctype() {
	parent::doctype();
	if (isset($this->content['a_form'])) {
		$a_form = $this->content['a_form'];
		unset($this->content['a_form']);
		$this->content['a_form'] = $a_form;
	}
}

This code puts answer form code (key a_form in array $this->content) at end of queue in page content array $this->content, and therefore answer form will show after all answers, in bottom.

Solution 2

Add below function in your theme main file. This code swaps a_form and a_list.

function main_parts($content) {
	$newcontent = array();
	if (isset($content['a_form']) && isset($content['a_list'])) {
		$a_form = $content['a_form'];
		$a_list = $content['a_list'];
		foreach($content as $key => $item) {
			if ($key == 'a_form')
				$newcontent['a_list'] = $a_list;
			elseif ($key == 'a_list')
				$newcontent['a_form'] = $a_form;
			else
				$newcontent[$key] = $item;
		}
		qa_html_theme_base::main_parts($newcontent);
	} else {
		qa_html_theme_base::main_parts($content);
	}
}

Restrictions: Pagenation is displayed after answer form. It is necessary to change it more to solve this.

Your answer

Try to answer the question as detailed as possible.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.