WordPress.org

Forums

Shortcode for cloaked email? (2 posts)

  1. wideangledan
    Member
    Posted 1 year ago #

    I'm using this bit of javascript to hide my Email which I found from this website:

    http://www.philmorgan.net/php-code/e-mail-munger-a-php-function-to-display-click-able-but-spam-safe-e-mail-addresses-on-web-pages

    All I have to do is drop this code: <?=mungemail('email@domain.net')?> in a post with some php-in-post plugin enabled and it works fine. Except for the fact that the visual editor wipes the code out if I switch to it.

    Someone here suggested using shortcodes:
    http://wordpress.org/support/topic/using-exec-php-without-disabling-visual-editor?replies=4

    I like the idea but I'm not sure how to integrate it so I can do something simple anywhere in my site like [email address="me@gmail.com" display="email me!"]

    Which would go something like $display

    Obviously not the real php code, but you get the idea.

    If someone could throw this down I'd be eternally grateful.

  2. wideangledan
    Member
    Posted 1 year ago #

    **Which would go something like:

    <a href=" mailto:<?=mungemail(' . $address . ')?>"> . $display . </a>

    But if they don't give $display a value, you would just see the Email address.

Topic Closed

This topic has been closed to new replies.

About this Topic