Thread Starter
Miood
(@miood)
Thank you for reply, but can you tell me precisely what should I do? I’m not a coder and this is why i just need more complex solution, than the right direction 🙂
The code in single.php:
<p><a href="mailto: <?php the_field('mail'); ?>"target="_blank"><?php the_field('mail'); ?></a></p>
How to use eae_encode_emails function to filter this?
Thanks for help.
That should do it:
<p><a href="<?php echo eae_encode_str('mailto:'.get_field('mail')); ?>"><?php echo eae_encode_str(get_field('mail')); ?></a></p>
I also have Advanced Custom Fields installed.
In Simple.php I replaced
<a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a> <br />
with
<p><a href="<?php echo eae_encode_str('mailto:'.get_field('mail')); ?>"><?php echo eae_encode_str(get_field('mail')); ?></a></p>
and it is not encoding the address.
The page is http://sidneybcdirectory.com/hagens-computers/
Your code seems to use your own $email variable, try this:
<a href="<?php echo eae_encode_str( 'mailto:' . $email ); ?>"><?php echo eae_encode_str( $email ); ?></a>
Thanks for the quick response. I inserted your code and I can still see plain text when I view the source.
Here is my code<p><a href="<?php echo eae_encode_str( 'mailto:' . $email ); ?>"><?php echo eae_encode_str( $email ); ?></a></p> <br />
Should the extra spaces be present?
Thanks for your help.
The extra spaces are just easier to read.
If you call the function eae_encode_str() you output will be encoded for sure. Maybe you site is cached?
You cannot use Firebug, Web Inspector or Dragonfly, to test the encoding, because they decode decimal/hexadecimal entities into plain text. To make sure your email address is encoded, right-click/secondary-click the page, click “View Source”, “View Page Source” or “Source” and search for any plain text email addresses.
Hi Till, I am not using any caching as far as I know. I have refreshed the page and also used F5.
I have looked on my site on another computer which has never viewed the site. I am using View Page Source and the plain text is still visible.
Well, then the only reason I can come up with is that you’re editing the wrong file, because everything that gets passed through eae_encode_str() will be encoded. Sure you’re editing the right file?