• Resolved larissakeepmake

    (@larissakeepmake)


    Hi, I”m using ACF fields on my post page, is there a way to display the helpful buttons beneath the fields. Could you provide code to insert into custom hook boxes or as a widget?

    The page I need help with: [log in to see the link]

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

    (@pixelbart)

    Hi @larissakeepmake,

    you can output the shortcode using PHP. You don’t need a hook for that. This will be easier in the future, but it will take a little longer, because I don’t have so much time for it at the moment. But it’s already my turn to rewrite Helpful completely.

    In PHP you can output the shortcode like this:

    <?php echo do_shortcode("[helpful]"); ?>

    Afterwards the automatic output of Helpful is deactivated. The option can be found in the Helpful settings under Details. There you can hide Helpful. Helpful will then no longer be output automatically.

    I hope I was able to help you a little. The shortcode will still work in the future and should not cause any problems.

    With the shortcode you can also ask individual questions per post. An example shortcode with a different heading looks like this:

    [helpful heading="How do you like that?"]

    Thread Starter larissakeepmake

    (@larissakeepmake)

    Yay it worked https://keepmake.com/beauty/jpiercy/my-favorite-drugstore-hair-product/

    Is it possible to insert the author display name into the header – example: leave Jodi feedback?

    Also, how do I change the color of the buttons – they’re both positive.

    Plugin Author Pixelbart

    (@pixelbart)

    @larissakeepmake

    Hi Larissa, you can only change the color of the buttons with CSS. Here is an example:

    .helpful-con {
      border-left: 2px solid #2ecc71 !important;
    }
    

    Just add this to the Customizer under Custom CSS. If you use the shortcode, you can do something like that:

    <?php
    // get global post data
    global $post;
    
    // get post author id
    $post_author_id = $post->post_author;
    
    // get user data
    $user_data = get_userdata($post_author_id);
    
    // set shortcode and change headline
    $shortcode = sprintf( 
      '[helpful heading="Leave %s feedback"]', 
      $user_data->display_name
    );
    
    // echo shortcode
    echo do_shortcode($shortcode);
    

    I hope this helps you. I will make a note of that and offer help in the future to make it easier.

    • This reply was modified 5 years, 10 months ago by Pixelbart.
    • This reply was modified 5 years, 10 months ago by Pixelbart.
    Thread Starter larissakeepmake

    (@larissakeepmake)

    I wasn’t able to get it working, added the code here https://screencast.com/t/jRzhNCawFUS
    Do we need to close the php?

    Plugin Author Pixelbart

    (@pixelbart)

    @larissakeepmake you have to replace my code with the one you used at ACF.

    Plugin Author Pixelbart

    (@pixelbart)

    @larissakeepmake now you can use {author} in the Helpful settings to display the “display_name” of the author. (Version 3.1.2)

    • This reply was modified 5 years, 10 months ago by Pixelbart.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Displaying helpful below ACF’ is closed to new replies.