Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.5k views
in Themes by
Hello All,

I want add ''something'' in my case ads code on sidepanel, but just on question page, when now add on sidepanel this show on whole pages home,tags,hot ... i need just on question page ?

Thanks,

:)
by
What do you mean by "case ads code on sidepanel"? A screenshot might help. Also pasting the code you're using right now (and mentioning in which file it is) would help understand what you're trying to do
by
ads code e.g. adsense ads code i want add just on question page, when i use admin panel and add on sidepanel they add on whole pages home,hot,tags ... i need this show only on question page, i guess i need edit question page file, but don't know which file ? i can't add here adsense code this is against adsense rules :)
by
edited by
Adsense is not part of the core. You must have configured that by means of a plugin. Which plugin are you using? Actually, I just need to see the code and see what the plugin is doing so if you can link to a github page that would be the best
by
edited by
sidepanel, question page, on question page we have sidepanel there i want add code, i don't know where i can edit this, where i edit sidepanel for question page ?

Thanks.

1 Answer

+1 vote
by
edited by

I don't understand by something add but I believe you want to show some content on only question page (Question View) if that is the case than use below code.

Wrap your code with the condition below

if ( $this->template === 'question')
{
    //put yoru code for something here
}

EDIT: With more detail

In your theme file qa-theme/your-theme-dir/qa-theme.php cross check if there is sidepanel() function already placed. Add/Update the code below

function sidepanel()
{    
    if ( $this->template === 'question' )
    {
        //add your code here
    }

    qa_html_theme_base::sidepanel();
}
by
The error says you have unexpected '<' in your theme file. You may by mistake added this one. Look in to your theme file.
by
> i can't found qa-theme.php
>> You need to look into your theme directory.
by
qa-theme - classic there not exsist qa-theme.php
by
i make qa-theme.php and add this code, again not work, but never mind i found this plugin https://github.com/svivian/q2a-widget-anywhere this fix all problem :) thanks all for help ;)
...