• Resolved Li-An

    (@li-an)


    Hello, I try to use your plugin directly in a template but I’ve got an error.

    <?php
        $email=the_field('email');
         echo do_shortcode( '[encode]' . $email . '[/encode]' );
         ?>

    gives this error

    Warning: Division by zero in /home/…/wp-content/plugins/email-address-encoder/email-address-encoder.php on line 163

    Thanks for any help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    In your code $email is an null variable, because the_field() prints the email, but not return it.

    Try this instead:

    
    <?php echo eae_encode_str(get_field('email')) ?>
    
    Thread Starter Li-An

    (@li-an)

    Thanks a lot. It seems to work perfectly – even with a href=mailto. Maybe you could add this in FAQ so other users may know.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘in template’ is closed to new replies.