- This topic has 7 replies, 3 voices, and was last updated 4 years, 4 months ago by Karim.
June 28, 2017 at 6:24 am #340659Karim
I have a quick question.
I just learned there’s a built in “Antispam” function in WordPress which can be activated by adding this code anywhere in the theme: <?php antispambot(‘heregoesyouremail’) ?>
I tried to add this code with the code snippets plugin you mentioned in some post, but it gives an error.
My question is: can i also execute/activate this piece of code with the Hooks build in the theme? If yes, in which part would you suggest?
Or should i use a child theme? I never used a child theme before, but i know the idea of it. How does it work, can i add the code in the functions.php file and that’s it?
Hope to hear from you.
KarimGeneratePress 1.3.48June 28, 2017 at 8:19 am #340723LeoStaffCustomer SupportJune 28, 2017 at 8:28 am #340728Karim
Thanks for quick reply.
I get this error: “The snippet has been deactivated due to an error on line 1:
syntax error, unexpected end of file”
When i place the code it is like this: <?php antispambot(‘myemail’) ?>
But when i hit save and activate it gives me the above error and the php tags are gone. So it looks like this: antispambot(‘myemail’)June 28, 2017 at 9:12 am #340765LeoStaffCustomer Support
I think you have to do something like this: https://codex.wordpress.org/Function_Reference/antispambot#ExamplesJune 28, 2017 at 9:29 am #340787Karim
Not sure which pieces of code i need of those. But i know you already give so much more support for something which is not your product. Respect for that:)June 28, 2017 at 9:32 am #340791LeoStaffCustomer Support
Ahh no. Looks like you just missed
echoand a semicolon:
<?php echo antispambot( 'email@example.com' ); ?>June 28, 2017 at 9:43 am #340807TomLead DeveloperLead Developer
I think the point of that is to make a shortcode which you can then use anywhere in your content.
That’s what they’re suggesting here: https://codex.wordpress.org/Function_Reference/antispambot#ExamplesJune 28, 2017 at 9:54 am #340818Karim
Give me some more time and soon i hope i understand more of this coding stuff:)
For now, i just i think i have to resort back to using a plugin for this.
- You must be logged in to reply to this topic.