Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How to order USERS+TAGS from left to right (like stackoverflow)

+4 votes
824 views
asked Aug 23, 2014 in Q2A Core by lancomega
edited Aug 27, 2014 by lancomega

How to change USERS+TAGS order lists from left to right (like stackoverflow), now by defaut is from top to down in my site.

=>

1 Answer

+3 votes
answered Aug 23, 2014 by pupi1985
selected Aug 23, 2014 by lancomega
 
Best answer
hI guess something like this would do the trick. Add this function to your qa-theme/<your-selected-theme>/qa-theme.php file:
 
function ranking($ranking)
{
    $this->part_title($ranking);
 
    $class=(@$ranking['type']=='users') ? 'qa-top-users' : 'qa-top-tags';
 
    $rows=min($ranking['rows'], count($ranking['items']));
 
    if ($rows>0) {
        $this->output('<table class="'.$class.'-table">');
 
        $columns=qa_opt('columns_' . $ranking['type']);
 
        for ($row=0; $row<$rows; $row++) {
            $this->set_context('ranking_row', $row);
            $this->output('<tr>');
 
            for ($column=0; $column<$columns; $column++) {
                $this->set_context('ranking_column', $column);
                $this->ranking_item(@$ranking['items'][$columns*$row+$column], $class, $column>0);
            }
 
            $this->clear_context('ranking_column');
 
            $this->output('</tr>');
        }
 
        $this->clear_context('ranking_row');
 
        $this->output('</table>');
    }
}
 
If the ranking function is already there then you're using a custom theme that has changed that behaviour, which means you will require a custom solution or ask the developer of the theme for support.
 
Anyway, it is a considerably easy fix. All I have actually done is copy/pasting the function from qa-theme-base.php and changed 2 lines from it. This gist might be clearer https://gist.github.com/pupi1985/48fbc928cfd65e38db51/revisions
commented Aug 23, 2014 by lancomega
edited Aug 27, 2014 by lancomega
ok thanks perfect! I edit qa theme base. I fixe everything according to your code and mine at the same time.
...