/includes/qa-theme-base.php
1 file, 2 place need add adsense,
header_script add adsense for home page,
public function head_script()
{
if (isset($this->content['script'])) {
foreach ($this->content['script'] as $scriptline) {
$this->output_raw($scriptline);
}
}
/* header
google adsense added
*/
$this->output('');
}
Do not need this one, if add this one, every post will have error duplicate tag, second tag will be ignored.
this is for each post add adsense
public function q_view_main($q_view)
{
$this->output('
'
);
if (isset($q_view['main_form_tags'])) {
$this->output('
}
$this->view_count($q_view);
$this->q_view_content($q_view);
/**
google adsense added
*/
$this->output('');
$this->q_view_extra($q_view);
https://www.question2answer.org/qa/14080/where-to-insert-custom-html-code-adsense-etc
Ok. I got it. Open includes/qa-theme-base.php and go down find see code under function q_view_main($q_view) on or around line # 1672. I wanted to put the adsense banner direcly below the question text/content and before the tags. So I inserted a new line $this->output('my adsense code
'); right under the line that says $this->q_view_content($q_view); . It worked great. Now I'll probably go about learning how to implement this using advanced themes by creating a custom q_view_main($q_view) function to override the default code. Any tips/example for newbies for creating function overrides would be appreciated from more experienced users. Thanks.
No comments:
Post a Comment