WordPress.org

Ready to get started?Download WordPress

Forums

Pixeline's Email Protector
[resolved] Using Email Protector outside of WP (6 posts)

  1. finalrune
    Member
    Posted 1 year ago #

    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

    http://wordpress.org/extend/plugins/pixelines-email-protector/

  2. pixeline
    Member
    Plugin Author

    Posted 12 months ago #

    hi!
    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('john@doe.com');?> and i'll get back to you A.S.A.P.

  3. finalrune
    Member
    Posted 9 months ago #

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

    The page I'm using this on is here: http://www.revisionenergy.com/maine-nh-solar-contractors-installers.php

    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: http://www.revisionenergy.com/blog/staff/geoff-sparrow/

    However, on my PHP page it says 'Email: geoff(Replace this parenthesis with the @ sign)revisionenergy.com'

    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!

  4. pixeline
    Member
    Plugin Author

    Posted 9 months ago #

    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)revisionenergy.com.

    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.

  5. pixeline
    Member
    Plugin Author

    Posted 9 months ago #

    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.

  6. finalrune
    Member
    Posted 9 months ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.