Support » Plugin: WP ULike » Likes on ACF repeater field

  • Resolved Bohdan Shila

    (@garpion)


    Hello! Im trying to set a like system on a ACF repeater field but when I like some item, its applies to all the items in that post. It’s the vote is relative to the whole post by default, but I need it to be relative to that repeater section so people can like each section independently. Is it possible?

    GIF example here: https://share.getcloudapp.com/2NurvpP5

    • This topic was modified 1 month, 1 week ago by Bohdan Shila.
    • This topic was modified 1 month, 1 week ago by Bohdan Shila.
    • This topic was modified 1 month, 1 week ago by Bohdan Shila.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Alimir

    (@alimir)

    Hello @garpion
    Yes, you only have to use the custom ID in your functionality.

    Hey @alimir, thanks for the answer! Is there some documentation about how can I use this custom ID functionality in my code?

    Plugin Author Alimir

    (@alimir)

    @garpion Do you use wp ulike display function or shortcode?

    i’m using the shortcode for now but it could use the function if its necessary.

    An example of my code:

    if( have_rows('contenido') ) {
        while ( have_rows('contenido') ) : the_row(); ?>
                <section>
                    <?php echo do_shortcode('[wp_ulike]'); ?>
                    <!-- More stuff inside -->
                </section>
    <?php endwhile;
    endif;
    Plugin Author Alimir

    (@alimir)

    There is no difference between them and you can use both modes.
    If you use shortcodes, you’ve to pass id parameter. e.g.
    [wp_ulike id=12]
    Now that you have created the code in a loop, it is best to create a structure that randomly builds into a specific ID string and holds that value.

    It partially works but when I refresh the page it still adds a +1 to all sections:
    https://share.getcloudapp.com/P8uYQJ66

    Here is my code:

    if( have_rows('contenido') ) {
        while ( have_rows('contenido') ) : the_row(); ?>
                <section id="<?php if(get_sub_field('css_id')){the_sub_field('css_id');} ?>">
                    <?php echo do_shortcode('[wp_ulike id="'.get_sub_field('css_id').'"]'); ?>
                </section>
    <?php endwhile;
    endif;
    Plugin Author Alimir

    (@alimir)

    @garpion This is very strange. Of course, in general, it is best to place the ID range in a specified category that does not interfere with other post IDs.

    One last question: I understand that the ID has to be numeric, right? I tried it with numeric values and it works great. But is there some way to make it work with strings?

    Plugin Author Alimir

    (@alimir)

    Hi,
    You may have trouble with some of our conditions! But you can test it.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.