Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #575755

    We are running a woocommerce site on Enfold (selling used machinery). On each product page we have a standard enfold contact form. When the forms come through in email format we want it to include the URL of the page it was sent from (A link to the actual product). Really struggling and appreciate any advice for what I assumed would be a simple task…

    #576266

    Hi Paul!

    Thank you for using Enfold.

    Please add this in the functions.php file:

    add_filter('avf_form_message', 'avf_form_message_mod');
    function avf_form_message_mod($message) {
    	global $post;
    	$message .= "<br>Page: ".get_the_title($post->ID);
    	return $message;
    }

    Best regards,
    Ismael

    #576436

    Thanks Ismael, Could you be specific about which Functions.php file. We tried it in the theme and child theme functions PHP file and it broke the site.

    Paul

    #576438

    Hey!

    Please go to Appearance > Editor and add the code Ismael posted above into functions.php file.

    Regards,
    Yigit

    #576638

    Thanks Yigit. I’ll try this.

    #576955

    Hi,

    Great, please let us know if you should need any more help on the topic.

    Thanks,
    Rikard

    #864015

    This is great, is there anyway to add the actual URL rather than just the page title?

    #864686

    Hi,

    Replace the get_the_title function with the get_the_permalink function.

    // https://developer.wordpress.org/reference/functions/get_the_permalink/

    Best regards,
    Ismael

    #1309942

    Hi

    My php skils kinda stink

    How would I format it to get
    Sent from: Page title ?

    This would be a good standard function btw.. usually in the websites that I build I put contact forms on every single page.. on the sites where this really matters to me I switched to Gravity Forms almost solely for this reason.. haha.. I should’ve searched a bit more maybe

    #1310600

    Hi,


    @joax
    : You need to replace this line within the filter or the snippet above.

    $message .= "Page: ".get_the_title($post->ID);
    

    Try to replace it with this code instead.

    $message .= "Sent from: " . get_the_title($post->ID);
    

    Best regards,
    Ismael

    #1317289
    This reply has been marked as private.
    #1317416

    Hi,

    You will have to append the links manually to the $message.

    $message .= "<a href='https://facebook.com?utm_source=Facebook&utm_medium=Sepet1&utm_campaign=tr-yeni">Facebook></a>";
    

    If you need more assistance, please feel free to open another thread. We will close this one for now.

    Best regards,
    Ismael

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Enfold contact form includes the URL of the page it is sent from’ is closed to new replies.