Support » Plugin: Helpful » Display Amount of Votes in Loop-Element?

  • Resolved survivestyle5plus

    (@survivestyle5plus)


    Hi Kevin,

    first of all I wanted to thank you for your first class plugin. Thank you for continuing to maintain it!

    Now to my question: I would like to use your plugin for an idea management (within a social intranet). Until now I have used the plugin “WP Ulike” to display the number of “Likes” in the loop element via shortcode. Similar to your plugin, you can then embed WP Ulike via shortcode in the single template. Thus, I can implement the following:

    On the overview page of the idea box (my name for the idea management) all created ideas are displayed as an archive. In the respective loop element the current number of likes is displayed (see screenshot). In the corresponding Single-Template you can vote for the idea by Like. If there is a Like in the Single-Template, the whole thing is synchronized directly with the Loop-Element.

    Now my question would be whether this is also possible with Helpful:

    In the Single-Template I have implemented Helpful without any problems via shortcode and set it via CSS so that only positive ratings can be made. Now I would like to show the number of positive votes in the loop element – ideally via shortcode. Furthermore, it must always be ensured that the number shown in the loop element runs synchronously with the number in the single template.

    Thanks in advance for your feedback!

    Greetings from Solingen to Dormagen.

    Manuel

    Screenshot of the Loop-Element:
    https://abload.de/img/loop_elemente3k55.png

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

    (@pixelbart)

    @survivestyle5plus

    This is possible in principle. You can do this with the following function of Helpful:

    https://helpful-plugin.info/docs/functions/helpful_get_pro/

    If you need a shortcode here, you would have to build it yourself. Here is an example:

    Place this in functions.php:

    add_shortcode('helpful_loop_pro', function () {
        $post_id = get_the_ID();
    
        if (!$post_id) {
            global $post;
            $post_id = (isset($post->ID)) ? $post->ID : false;
        }
    
        if (false === $post_id) {
            return 0;
        }
    
        return helpful_get_pro($post_id);
    });

    After that you can use [helpful_loop_pro] and the shortcode should do what you need – if the loop is set correctly with have_posts() etc.

    Maybe this already helps you. Maybe I’ll build more shortcodes for such cases that specifically concern a loop. Most of the people who want to put something in the loop just use the functions, because they already work with PHP.

    More Helpful functions: https://helpful-plugin.info/docs/functions/

    Stay healthy and thanks for your feedback!

    Thread Starter survivestyle5plus

    (@survivestyle5plus)

    Hi Kevin,

    wow- thanks for your quick feedback! Since I am not a PHP expert, your shortcode helped me a lot.

    One more supplementary question:

    Is it or will it be possible in the future that you can use different instances of Helpful?

    What I mean by that:

    I would like to use Helpful for two areas of my social intranet project:

    As described above as a rating system (only positive votes possible) for idea articles. As headline I would use “Should this idea be reviewed by the social intranet team for implementation?”. My basic idea behind this: Only if an idea article receives a minimum number of votes, it will be reviewed by an internal team for implementation.

    Also as a rating system for wiki articles (so more in the direction Helpful is actually intended for). As headline I would use “Was this wiki article helpful?” and after that the buttons for “Yes” and “No”.

    So as described above for two areas, but with a different heading for each.

    As always, thanks in advance for your feedback!

    Greetings

    Manuel

    PS: Is it possible to support you financially for the plugin, so that I can do my part to ensure the further development. As a programmer you do not live only on air & love 😉

    Plugin Author Pixelbart

    (@pixelbart)

    @survivestyle5plus

    Hi again,

    this should already be possible with the shortcode. You should be able to do the following:

    [helpful heading=”question 1″]
    [helpful heading=”question 2″]

    You can find all available values here: https://helpful-plugin.info/docs/getting-started/shortcodes/

    Zu deinem PS: Das ist möglich, aber überhaupt nicht notwendig. Hier findest du die Kaffeekasse: https://pixelbart.de/kaffeekasse/

    Das schreibe ich dir auf Deutsch, da dies ja nicht wirklich den Support betrifft und nicht so relevant für die anderen ist.

    Thread Starter survivestyle5plus

    (@survivestyle5plus)

    Hi Kevin,

    works perfectly. Thanks a lot!

    Manuel

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display Amount of Votes in Loop-Element?’ is closed to new replies.