Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
969 views
in Q2A Core by
I have been looking for the solution for last few months. Please help me!

1 Answer

0 votes
by
edited by
I use the following function from qa-include/qa-theme-base.php to show only questions from the homepage by checking the template.

        function q_list_items($q_items)
        {
            
            if ($this->template == 'qa') { //if homepage template
                foreach ($q_items as $q_item)
                    if ($q_item['raw']['categoryid'] == 2)
                        $this->q_list_item($q_item);
                
            } else { //else list as normal
                foreach ($q_items as $q_item)
                    $this->q_list_item($q_item);
            }
              
        }

There's a list of template names in the following question in case you (or anyone else) wants to block posts from a specific category on other pages than the home page.

http://www.question2answer.org/qa/21220/if-%24this-template-unanswered-not-working?show=21220#q21220
by
I just realized there is a problem with my solution, as described in the answer of the following question:
http://www.question2answer.org/qa/14058/exclude-category-in-questions-list

It seems it would require changing the db call...
...