• Resolved sekhemty

    (@sekhemty)


    Hi, I have a couple of email addresses in my site footer, and I’d like to have them obfuscated as well.
    I’ve read the FAQs, and I noticed this:

    If you want to encode a single email address, use the eae_encode_str() function: <?php echo eae_encode_str( ‘[email protected]’ ); ?>

    I’m sure that this instruction is pretty simple to understand, but i’m not that expert and I need help.

    I have this kind of code:

    Website made by <a href="mailto:[email protected]" target="_blank">Myself</a>

    How should I modify it with the above function in order to obfuscate it?

    • This topic was modified 8 years, 4 months ago by sekhemty.
Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Just like this:

    Website made by <a href="<?= eae_encode_str( 'mailto:[email protected]' ); ?>">Myself</a>
    

    Or if you want to display an email address, you could do this:

    Email me at <a href="<?= eae_encode_str( 'mailto:[email protected]' ); ?>"><?= eae_encode_str( 'mailto:[email protected]' ); ?></a>
    
    • This reply was modified 8 years, 4 months ago by Till Krüss.
    • This reply was modified 8 years, 4 months ago by Till Krüss.
    Thread Starter sekhemty

    (@sekhemty)

    It doesn’t seem to work.

    The output is something like

    https://www.mysite.com/%3C?=%20eae_encode_str(%20%27mailto:[email protected]%27%20);%20?%3E

    Plugin Author Till Krüss

    (@tillkruess)

    Mhh, could you post the entire file where you insert the “Website made by” link? Or is it inside text field in WordPress?

    Thread Starter sekhemty

    (@sekhemty)

    It is inside a text field, it accepts standard html code but apparently it has some problems with php.

    If it is relevant, I’m using X Theme from Themeco.

    Plugin Author Till Krüss

    (@tillkruess)

    Since that’s a premium theme I can’t access the source code. Could you ask their support team if there is a way to filter the inputs of that text field where you insert the footer text?

    Thread Starter sekhemty

    (@sekhemty)

    I’ll try to ask in their support forum then. Thank you.

    Plugin Author Till Krüss

    (@tillkruess)

    You’ll need to do something like:

    
    add_filter( 'x_theme_footer_text', 'eae_encode_emails' );
    
    Thread Starter sekhemty

    (@sekhemty)

    I’ve asked in their forum but they don’t provide support for third party plugins.

    Plugin Author Till Krüss

    (@tillkruess)

    That’s a pity. Like I said, I sadly can’t help you with this issue without having access to the source code of your theme. If you like, you can hire me to work out this issue directly on your server.

    Thread Starter sekhemty

    (@sekhemty)

    Thank you for your offer, but at the moment I’d like to try how to solve this myself, if you could be so kind to give me a couple more answers. (I’m kinda new about all of this and every issue is an opportunity to learn; anyway, if you can’t or don’t want to help me further, I understand).

    If I’m not wrong, your previous suggestion is a function that I need to add to my (child) theme functions.php ; the last bit of text is related to your plugin, and the first one (x_theme_footer_text) is your guess about my current theme, am I right?

    Maybe this question is silly, but is this a CSS selector?

    Plugin Author Till Krüss

    (@tillkruess)

    You have to first find out how and where your theme is displaying the footer text your entered in WordPress. I first guess would be to check the footer.php file of your theme.

    I’d compare the output generated by your theme (with the un-encoded email address) and then look at the footer.php file to see where that text field is printed.

    If you’re cool with hit, you could post the contents of your footer.php file. Use something like https://pastebin.com for that.

    paulovsky

    (@paulovsky)

    Hello!

    Can you please help me with coding the email to my header? The email is pulled from the theme options so I am not sure what to do.

    The function is below:

    <?php if ( '' !== ( $et_email = et_get_option( 'header_email' ) ) ) : ?>
    <a href="<?php echo esc_attr( 'mailto:' . $et_email ); ?>"><span id="et-info-email"><?php echo esc_html( $et_email ); ?></span></a>
    <?php endif; ?>
    • This reply was modified 8 years ago by paulovsky.
    Plugin Author Till Krüss

    (@tillkruess)

    
    <?php if ( '' !== ( $et_email = eae_encode_str( et_get_option( 'header_email' ) ) ) ) : ?>
    <a href="<?php echo esc_attr( 'mailto:' . $et_email ); ?>"><span id="et-info-email"><?php echo esc_html( $et_email ); ?></span></a>
    <?php endif; ?>
    
    paulovsky

    (@paulovsky)

    Yey! You’re the best!

    I’ll share this with the theme’s authors (Divi).

    Thread Starter sekhemty

    (@sekhemty)

    This was marked as solved but was just the second poster’s problem.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Newbie question about footer email’ is closed to new replies.