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

I am trying to get the avatar inside the .qa-q-view-meta <span>. I tried moving with css but that's how far I could go

 

I want it to be something like this

The file I was trying to edit was qa-app-format.php, but I couldn't go anywhere!!

I hope someone will help

Thanks

3 Answers

0 votes
by

Ok, I think I will just post an answer since I figure it out :)

 

Find the function      function post_meta_who($post, $class){} in qa-theme-base.php and add this:

                                    if (isset($post['avatar'])) {
                if (isset($prefix))
                    $this->output($prefix);

                $this->output('<SPAN CLASS="'.$class.'-avatar">', $post['avatar'], '</SPAN>');
            }

If you don't want the avatar hanging out at the left side, then just comment what's in this function

function post_avatar($post, $class, $prefix=null)


       

by
You should never make any changes to qa-theme-base.php file instead you should use advance theme or layer to modify qa-theme-base.php methods
0 votes
by

Changing qa-theme-base.php directly is not recommended except for the case where it is unavoidable. I recommend you to create or edit qa-theme.php under your theme folder. Lower code adds one argument to post_avatar(), and function is overrided as new here function. In this example, avatar is displayed after the output of post_meta_who(). You can also copy code of post_meta_who() in qa-theme-base.php and can call post_avatar() at your favorite place.

class qa_html_theme extends qa_html_theme_base
{
  function post_avatar($post, $class, $prefix=null, $output=false)
  {
    if($output)
      qa_html_theme_base::post_avatar($post, $class, $prefix);
  }
  function post_meta_who($post, $class)
  {
    qa_html_theme_base::post_meta_who($post, $class);
    $this->post_avatar($post, $class, null, true);
  }
}

 

+1 vote
by

If you are looking for very easy and CSS hack to make it work than here is the solution.

Make sure I am considering Snow theme and Q2A( this site ) avatar size which you may need to alter according to your choice and settings.

add below property to the appropriate classes in your css file

 

.qa-q-view-main{
position: relative;
}
.qa-q-view-avatar{
position: absolute;
left: 15px;
top: 85px;
}
 
Change left and top px as you need and done.. :)
...