• Resolved Torsten Bulk

    (@torstenbulk)


    Hello,

    Happyforms is a great plugin and everything is very comfortable to handle.

    One point concerns me: How can links be inserted in multi selection fields?

    What is there for a solution?

    Best regards

    Torsten

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support Ignazio Setti

    (@ignaziohappyforms)

    Hey there, @torstenbulk! πŸ‘‹

    Happyforms doesn’t allow links (or other HTML tags) inside Single and Multiple Choice field options, we’re sorry!

    It’s technically doable in that you can override templates for your fields, and force them to output HTML, but it’s also quite risky as new plugin releases might ship changes to the same templates, and you’d need to keep your customizations in line with those changes. If you’re okay with that, just let us know and we’ll share a step-by-step guide.

    Let us know what you think!

    Thread Starter Torsten Bulk

    (@torstenbulk)

    Hello Ignazio,

    Please send me the instructions.

    About a function you can not get that?

    Best regards

    Torsten

    Plugin Support Ignazio Setti

    (@ignaziohappyforms)

    Sounds good, @torstenbulk!

    Just to be sure, are you running our free version, or one of our upgrade ones? If you’re on an upgrade plan, would you please write us at support(at)thethemefoundry(dot)com?

    Let us know!

    Thread Starter Torsten Bulk

    (@torstenbulk)

    the free version.

    Plugin Support Ray Loyloy

    (@rayhappyforms)

    Hey there, @torstenbulk πŸ‘‹ I hope you had a wonderful weekend!

    Could you please share with us the link to your form? We’d like to have a direct look at it first β€” to be sure we’re sharing the correct steps.

    Also, could you please share the links you want to add and on which choice of the Multiple Choice field it will be added?

    Let us know!

    Thread Starter Torsten Bulk

    (@torstenbulk)

    Hello,

    the page is still under construction and not online.

    I can but briefly describe where the link should go in:

    In Europe, data protection is extremely regulated. And therefore the privacy policy must be accepted before sending (this is a mandatory field) and here the word privacy should contain a link to the privacy policy.

    I can but send the link and a backend access by email or similar.

    Best regards

    Tosten

    • This reply was modified 1 year, 2 months ago by Torsten Bulk.
    Plugin Support Ignazio Setti

    (@ignaziohappyforms)

    No worries, @torstenbulk!

    We can work this out without sharing any additional details. Here’s how it works:

    1. Copy this file:

    /wp-content/plugins/happyforms/core/templates/parts/frontend-checkbox.php

    to the root of your theme or child theme.

    2. Open the frontend-checkbox.php file in your child theme, and replace this string:

    <?php echo esc_attr( $option['label'] ); ?>

    with this one:

    <?php echo html_entity_decode( $option['label'] ); ?>

    then save your file.

    3. Pop this snippet in your theme or child theme functions.php file:

    add_filter( 'happyforms_part_frontend_template_path_checkbox', function( $template ) {
        $template = get_stylesheet_directory() . '/frontend-checkbox.php';
    
        return $template;
    } );

    4. When adding choices to your Multiple Choice field, you can now use HTML tags in your choice Label fields, like this:

    <a href="https://www.google.com">Google</a>

    I hope that helps! Let us know how that goes. πŸ™‚

    Thread Starter Torsten Bulk

    (@torstenbulk)

    This works perfectly πŸ™‚

    Thanks for the support!

    Best regards

    Torsten

    • This reply was modified 1 year, 2 months ago by Torsten Bulk.
    Plugin Support Ignazio Setti

    (@ignaziohappyforms)

    Glad to hear it worked, @torstenbulk! πŸ‘

    Let us know in case something else crops up.

    Hi Ignazio,
    very good! I also searched and built it into my forms. Privacy check is important in the EU. Can you add that to the plugin?

    Greetings Hans

    Hello Ignazio and Torsten,
    this is my simple solution:

    // Allow HTML-Code for HappyForms at multi selection fields
    // Is Plugin HappyForms activ?
            if (!function_exists('is_plugin_active')) {
                require_once ABSPATH . '/wp-admin/includes/plugin.php';
            }
            if (is_plugin_active('happyforms/happyforms.php')) {
    //  Change Strings in frontend-checkbox.php
    $path_to_file = ABSPATH . 'wp-content/plugins/happyforms/core/templates/parts/frontend-checkbox.php';
    $file_contents = file_get_contents($path_to_file);
    $file_contents = str_replace("<?php echo esc_attr( \$option['label'] ); ?>","<?php echo html_entity_decode( \$option['label'] ); ?>",$file_contents);
    file_put_contents($path_to_file,$file_contents);
    add_filter( 'happyforms_part_frontend_template_path_checkbox', function( $template ) {
        $template = ABSPATH . 'wp-content/plugins/happyforms/core/templates/parts/frontend-checkbox.php';
        return $template;
    } );
    }

    Built into functions.php or a snippet plugin.
    A plugin for this will come later.
    What do you think?

    Hi,

    this is a solution with inserting a plugin instead of PHP code (Written in German ).

    Have fun πŸ™‚

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Insert links in multi selection fields’ is closed to new replies.