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

@Scott - one problem caused by core:

   function a_selection($post) is always outputting:

   $this->output('<div class="qa-a-selection">');

For my current theme I have to use CSS to target .qa-a-selection (and there is no other way around) for answers that have not been selected yet.

Problem is, because the core always outputs .qa-a-selection, that I cannot style this field adding an :after element. Then even the answers that users cannot select, get the after element. 

Solution: Only output qa-a-selection if the user can do the selection (sounds logical to me).

Greetings,
Kai

 

Q2A version: 1.6.3
by
FYI, luckily this function is in qa-theme-base.php and we can override it using an advanced theme.
by
Entire HTML is in qa-theme-base so you can change markup anytime you want no matter where and what. However many parts of them are very tricky to handle.

1 Answer

0 votes
by

That should do it:


    function a_selection($post)
    {
        if( isset($post['select_tags']) || isset($post['unselect_tags']) || $post['selected'] || isset($post['select_text']) ) {
            $this->output('<div class="qa-a-selection">');
            
            if (isset($post['select_tags']))
                $this->post_hover_button($post, 'select_tags', '', 'qa-a-select');
            elseif (isset($post['unselect_tags']))
                $this->post_hover_button($post, 'unselect_tags', '', 'qa-a-unselect');
            elseif ($post['selected'])
                $this->output('<div class="qa-a-selected">&nbsp;</div>');
            
            if (isset($post['select_text']))
                $this->output('<div class="qa-a-selected-text">'.@$post['select_text'].'</div>');
            
            $this->output('</div>');
        }
    }
 

...