Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author grosbouff

    (@grosbouff)

    Yes, if you know how to code in a WP environnement :
    I won’t implement such a feature for now since I try to keep the plugin as simple as possible, and that not everyone will need such a function.

    How to do it ? You have to create a custom function in the functions.php file of your theme, and hook that custom function on a bbpress action.

    Let’s dig into bbPress templates.

    loop-topics.php do not have hooks to add columns, so you won’t be able to have a specific column for your votes, unless you have a custom theme for bbPress.

    But you can add the votes after the content of a column : have a look at the bbPress file loop-single-topic.php.

    For example, you can use the action hook bbp_theme_after_topic_meta.

    Here’s a quick code i wrote, I haven’t tested it; but it should help :

    //add this in functions.php
    
    function my_custom_function_show_votes_after_topic_title(){
        $votes_up = bbpvotes_get_votes_up_for_post( bbp_topic_id() );
        $votes_down = bbpvotes_get_votes_down_for_post( bbp_topic_id() );
        ?>
        <p class="bbpvotes-topic-votes-container">
            <span class="bbpvotes-topic-votes bbpvotes-topic-votes-up"><?php echo $votes_up;?></span>
            <span class="bbpvotes-topic-votes bbpvotes-topic-votes-down"><?php echo $votes_down;?></span>
        </p>
        <?php
    }
    
    add_action('bbp_theme_after_topic_meta','my_custom_function_show_votes_after_topic_title');

    Then you just have to set some CSS rules so it shows thumbs before the span items.

    Hope it helps !

    Thread Starter DealL

    (@deall)

    Is it necessary to add a column? Can you insert the code within the first column itself?

    Just align it to the right + bottom

    example – https://i.imgur.com/8bknvaP.jpg

    Plugin Author grosbouff

    (@grosbouff)

    @DeaIL : yes, you can insert the code within the first column.
    That is what I explained in my previous post.

    Thread Starter DealL

    (@deall)

    Thank you for all the help ?? Just one more question. I want the users to vote the first post (topic) only and not the replies. For example please see below image.

    https://i.imgur.com/ixCgtwJ.jpg

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Vote count as topic headings’ is closed to new replies.