Hello, in your theme's qa-theme.php file add the following code snippet in side the class qa_html_theme:
FOR adding adcode in between question:
function q_view_content($q_view)
{
if (!empty($q_view['content'])) {
$text = $q_view['content'];
$part1 = substr($text, 0, floor(strlen($text) / 2));
$part2 = substr($text, floor(strlen($text) / 2));
if (substr($part1, 0, -1) != ' ' AND substr($part2, 0, 1) != ' ')
{
$middle = strlen($part1) + strpos($part2, ' ') + 1;
}
else
{
$middle = strrpos(substr($text, 0, floor(strlen($text) / 2)), ' ') + 1;
}
$part1f = substr($text, 0, $middle); // "The Quick : Brown Fox Jumped "
$part2f = substr($text, $middle); // "Over The Lazy / Dog"
//Replace your AD Code here
$adcode = "<br /><br />YOUR AD HERE<br />YOUR AD HERE<br /><br />";
$this->output('<div class="qa-q-view-content">');
$this->output_raw($part1f . $adcode . $part2f);
$this->output('</div>');
}
//qa_html_theme_base::q_view_content($q_view);
}
For adding ad code in between answer:
function a_item_content($a_item)
{
$text = $a_item['content'];
$part1 = substr($text, 0, floor(strlen($text) / 2));
$part2 = substr($text, floor(strlen($text) / 2));
if (substr($part1, 0, -1) != ' ' AND substr($part2, 0, 1) != ' ')
{
$middle = strlen($part1) + strpos($part2, ' ') + 1;
}
else
{
$middle = strrpos(substr($text, 0, floor(strlen($text) / 2)), ' ') + 1;
}
$part1f = substr($text, 0, $middle); // "The Quick : Brown Fox Jumped "
$part2f = substr($text, $middle); // "Over The Lazy / Dog"
//Replace your AD Code here
$adcode = "<br /><br />YOUR AD HERE<br />YOUR AD HERE<br /><br />";
$this->output('<div class="qa-a-item-content">');
$this->output_raw($part1f . $adcode . $part2f);
$this->output('</div>');
//qa_html_theme_base::a_item_content($a_item);
}
Replace you AD code at the point where it is commented as such