Support » Plugin: Pixeline's Email Protector » Using Email Protector outside of WP

  • Resolved finalrune


    OK, this may be pushing the envelope a bit, but I’m wondering if I can use Email Protector on a PHP page elsewhere on my website where I extract WordPress content using WP_Query arguments and a if -> have_posts type loop (displays the_content). What happens now is that I get the text of the emails with the spamblock text intact. I assume this is just because I am not running the Javascript defuscate function? Is there a way to link up this Javascript outside of the plugin?

    Thanks for a great plug!

    – Fred

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author pixeline


    Did you try calling the wp_head() function early in your external php script (after you’ve loaded wp-load.php) usually inside the html HEAD tags?
    Once loaded, you can use the safe_email( $email) function on any string inside your external php page. Ex:

    Write me at <?php echo safe_email('');?> and i'll get back to you A.S.A.P.

    Thanks… OK… let me see if I get this.

    The page I’m using this on is here:

    This is a static php page that uses a WP Query to find posts through the WP loop that match a custom post-type called “Staff.”

    In the content of the post-type staff, is a field ’email’ which is correctly ‘protected’ inside of WordPress as on:

    However, on my PHP page it says ‘Email: geoff(Replace this parenthesis with the @ sign)’

    I believe this is because the line above is what is actually in the WP database for that post…? Is there a way to run your plugin on top of the loop, after everything loads, to re-create the ‘protected’ emails with links?

    Thanks… great plugin by the way!

    Plugin Author pixeline


    no, the database stores the original, unmodified email address.

    On rendering, the plugin filters and transforms the email into geoff(Replace this parenthesis with the @ sign)

    Then, and this is the part that fails, is the javascript turning the transformed email into a clicable email mailto: link.

    So Look at your javascript console, check if the script is loaded and if there are any errors.

    Plugin Author pixeline


    I just looked in the page source code and … boy. You are loading 2 versions of jquery, which is just asking for trouble. You also have a javascript error produced by a google ads script. Finally, i couldn’t find any link pointing to my plugin’s javascript file.

    Alright, well thanks for putting me on the right track! At least I know where to work on fixing it now.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Using Email Protector outside of WP’ is closed to new replies.