Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
659 views
in Q2A Core by

I'm finally upgrading my site to version 1.3 (from 1.2). I started the theme again from scratch in order not to overwrite too much new stuff. But I must have changed quite a lot around in my old theme....

First, I want to hide the related questions from the bottom. But it seems to just call generic functions like "q_list_and_form" - how do I detect that it's the related questions?

The second part is to put the related questions on the sidebar. In my old theme I simply had this in the sidepanel function:

if ( isset($this->content['related_q_list']) )
{
$this->output('<div class="qa-related-sidebar">');
$this->q_list_titles($this->content['related_q_list']);
$this->output('</div>', '');
}

But now there doesn't seem to be a "related_q_list" element - is there a different way to do it?

1 Answer

+2 votes
by

The logic is mostly the same, but in version 1.3 the element is called 'q_list' instead of 'related_q_list'. But this element name is also used on other pages so you should also check ($this->template=='question') where appropriate.

by
Thanks it's working. Is the following enough to hide the questions from the bottom of the page?

    function q_list_and_form($q_list)
    {
        if ( $this->template == 'question' )
            return;       
        parent::q_list_and_form($q_list);
    }

This assumes there aren't any other question lists when you're viewing a question. Plus I just realized it makes good sense to call the parent theme function to do the default stuff, if I've only added a little code before or after the parent code.
by
Yes, this is exactly the right approach, since there are no other question lists on the question page.
...