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

I got a bit stuck in changing the vote button (the thumbs up) into a "normal" labelled button, for example:

I like it  ]

To achieve this, I think I need to override function vote_buttons($post):

$this->post_hover_button($post, 'vote_up_tags', '+', 'qa-vote-one-button qa-voted-up');


$this->post_hover_button($post, 'vote_up_tags', 'i like it', 'qa-vote-one-button qa-voted-up');

Has anyone got a better solution?

What is wrong with that particular solution?
For my recent project I wanted to give a label instead an icon, the label is to be change is text, e.g. I am displaying the number of likes within the button now, check my implementation at: http://www.schreibgenuss.de/81/willkommens-gedicht (scroll down bottom right of question, yellow button).

PS: I am posting my solution as an answer now...
An important note: When I wanted to reposition the VOTE buttons in the (html) line of the other buttons (see sama55's screenshots) it did not work. Big problem is that with repositioning - i.e. taking $this->voting() to another position, we have the voting form within the buttons form, which is not allowed. Then you get this q2a message "Please reload the page then try again"...

It took me 1 hour to find out.

2 Answers

+1 vote

I want to do the same thing, too.  Because I want to attach image, write in answer, but this is comment.

Example of my site button group:



Relatively big customization seems to be necessary to realize this.

  • Change all specific terms (vote, votes, vote up, vote down, etc...) in the language file
  • Change of the layer / theme program (Including matter that Kai says)
  • Change of your theme's CSS
  • When you add icon, you should remake sprited image.

These are the things which I noticed, but, many changes may be necessary. . .

Hi sama, see my answer / solution above :)
0 votes

This is how I implemented the required label using an advanced theme (note, labels are in German, yellow button):

function voting_inner_html($post)
    // $this->vote_count($post);

function vote_buttons($post)
    $this->output('<div class="qa-vote-buttons '.(($post['vote_view']=='updown') ? 'qa-vote-buttons-updown' : 'qa-vote-buttons-net').'">');

    $likes = $post['raw']['upvotes'];
    $peoplePlural = ($likes!=1) ? 'Personen' : 'Person';
    $buttonlabel = 'Gefällt '.$likes.' '.$peoplePlural.' • Dir auch?';
    $buttonlabel2 = 'Gefällt '.$likes.' '.$peoplePlural;
    if($likes==0) {
        $buttonlabel = 'Gefällt dir der Beitrag?';
        $buttonlabel2 = 'Gefällt dir der Beitrag?';
    switch (@$post['vote_state'])
        case 'voted_up':
            $this->post_hover_button($post, 'vote_up_tags', $buttonlabel2, 'qa-vote-one-button qa-voted-up');
        case 'voted_up_disabled':
            $this->post_disabled_button($post, 'vote_up_tags', $buttonlabel2, 'qa-vote-one-button qa-vote-up');
        case 'voted_down':
            $this->post_hover_button($post, 'vote_down_tags', '&ndash;', 'qa-vote-one-button qa-voted-down');
        case 'voted_down_disabled':
            $this->post_disabled_button($post, 'vote_down_tags', '&ndash;', 'qa-vote-one-button qa-vote-down');
        case 'up_only':
            $this->post_hover_button($post, 'vote_up_tags', $buttonlabel, 'qa-vote-first-button qa-vote-up');
            $this->post_disabled_button($post, 'vote_down_tags', '', 'qa-vote-second-button qa-vote-down');
        case 'enabled':
            $this->post_hover_button($post, 'vote_up_tags', $buttonlabel, 'qa-vote-first-button qa-vote-up');
            $this->post_hover_button($post, 'vote_down_tags', '&ndash;', 'qa-vote-second-button qa-vote-down');

            $this->post_disabled_button($post, 'vote_up_tags', '', 'qa-vote-first-button qa-vote-up');
            $this->post_disabled_button($post, 'vote_down_tags', '', 'qa-vote-second-button qa-vote-down');



.qa-vote-up-button, .qa-voted-up-button {
    margin-right:3px !important;
    overflow:visible; /* overflow:visible for IE */
.qa-vote-up-button:hover, .qa-voted-up-button:hover {color:#000;}
.qa-voted-up-button {
    cursor:default !important;
.qa-vote-up-button, .qa-voted-up-button {
    text-decoration:none !important;
    /*font-family:"MS Trebuchet",Arial,Helvetica;*/
    border:1px solid #AAA;
    padding:5px 10px;
    background: #ffc533;
    background: -moz-linear-gradient(top, rgba(255,248,228,1) 0%, rgba(255,197,51,1) 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,248,228,1)), color-stop(100%,rgba(255,197,51,1)));
    background: -webkit-linear-gradient(top, rgba(255,248,228,1) 0%,rgba(255,197,51,1) 100%);
    background: -o-linear-gradient(top, rgba(255,248,228,1) 0%,rgba(255,197,51,1) 100%);
    background: -ms-linear-gradient(top, rgba(255,248,228,1) 0%,rgba(255,197,51,1) 100%);
    background: linear-gradient(to bottom, rgba(255,248,228,1) 0%,rgba(255,197,51,1) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="#fff8e4", endColorstr="#ffc533",GradientType=0 );