- This topic has 7 replies, 3 voices, and was last updated 3 years, 9 months ago by
Karim.
-
AuthorPosts
-
June 28, 2017 at 6:24 am #340659
Karim
Hello there:)
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.
Thanks:)
Karim
GeneratePress 1.3.48June 28, 2017 at 8:19 am #340723Leo
StaffCustomer SupportHi there,
What error did you get using Code Snippets? Generally that’s the best way.
Just want to make sure you won’t get the same error using other methods as well.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 28, 2017 at 8:28 am #340728Karim
Hello Leo:)
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 #340765Leo
StaffCustomer SupportI think you have to do something like this: https://codex.wordpress.org/Function_Reference/antispambot#Examples
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 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 #340791Leo
StaffCustomer SupportAhh no. Looks like you just missed
echo
and a semicolon:<?php echo antispambot( 'john.doe@mysite.com' ); ?>
https://codex.wordpress.org/Function_Reference/antispambot#Default_Usage
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 28, 2017 at 9:43 am #340807Tom
Lead DeveloperLead DeveloperI 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#Examples
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 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.
Thanks guys:)
-
AuthorPosts
- You must be logged in to reply to this topic.