Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey there, @root09!

    HappyForms doesn’t include a visual control for that, we’re sorry! Luckily, it’s quite easy to do with a bit of PHP and HappyForms hooks.

    If you’re up for the challenge, let us know! We’ll be glad to share a simple step by step example.

    Thread Starter root09

    (@root09)

    Hey @thethemefoundry
    ok for the chalenge …

    BUT…to be honest with you, it will be “difficult”
    for me…

    thanks for you patience…
    ??

    Got it, @root09!

    It’s luckily quite simple. Try these steps:

    1. Add a Short Text part to your form. Doesn’t matter where – we’ll eventually hide it with CSS.
    2. In your part configuration widget, click the Advanced link.
    3. Set your Custom CSS class option to happyforms-part-page-id. Save your form.
    4. Pop this snippet in your theme functions.php file:

    function child_theme_happyforms_part_value( $value, $part, $form ) {
    	if ( strpos( $part['css_class'], 'happyforms-part-page-id' ) !== false ) {
    		$value = get_permalink();
    	}
    
    	return $value;
    }
    
    add_filter( 'happyforms_the_part_value', 'child_theme_happyforms_part_value', 10, 3 );

    5. Refresh the page containing your form, and check the value of this new part we just added. It should contain the current page address.

    Let’s nail this down first. If everything worked, we’ll proceed hiding this part with a bit of CSS.

    Let us know how you go!

    Thread Starter root09

    (@root09)

    Hey @thethemefoundry

    its working !
    look > https://prnt.sc/mam7g8

    email result > > https://prnt.sc/mam7ob

    now, we must hide the field ??

    thanks !

    Great news, @root09! ??

    Hiding it is just a matter of simple CSS. Pop this in your AppearanceCustomizeAdditional CSS screen:

    .happyforms-part-page-id {
        display: none;
    }

    That should do the job. Let us know if that worked!

    Thread Starter root09

    (@root09)

    @thethemefoundry

    is working with ” !important ”

    .happyforms-part-page-id {
        display: none !important;
    }
    

    also i have put your code in the “mu-plugin ”
    to avoid any problem with theme update.

    many tanks ??

    Oh, okay! Glad to hear we could help, @root09 ??

    Let us know if you ever have more questions!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to include a referer ?’ is closed to new replies.