Email Address Encoder
[resolved] Does not encode link with custom text (10 posts)

  1. Matthias
    Posted 3 years ago #

    I'm not sure whether I misconfigured something in my template or if the plugin really doesn't encode the mailto-link when text (other than the mail address) is linked.

    Or you can <a title="Send email to xyz" href="mailto:you@yourdomain.com">send us an email</a>.

    It works fine when an email address is written in the text.
    Anyone else having the same issue?



  2. Till Krüss
    Plugin Author

    Posted 3 years ago #

    If your content isn't passed through the the_content filter (or a few others), then you'll need to encode it manually in your template files.

    Where is that snippet above coming from, the WordPress editor, or from a template file?

  3. Matthias
    Posted 3 years ago #

    Hmm.. found why it doesn't work: The snippet above is written in the WordPress Editor and is placed on a (static) content page. Somewhere before that part there is a shortcode that shows posts from a certain category (announcements), which should be displayed as normal content in between two other text blocks (written in the editor).

    When I remove the shortcode above that said text part, the plugin works fine and the email link is encoded.

    This is the part where the shortcode gets the posts:

    $return_string = '';
    query_posts(array('orderby' => $order_by, 'order' => $order, 'cat' => $category_id , 'category_name' => $category_name , 'showposts' => $posts));
    if (have_posts()) :
        while (have_posts()) : the_post();
            $content = get_the_content();
            $content = apply_filters('the_content', $content);
            $content = str_replace(']]>', ']]>', $content);
            $return_string .= '<div class="listed-post">';
            $return_string .= '<h2>'. get_the_title() .'</h2>';
            $return_string .= $content;
            $return_string .= '</div>';
    return $return_string;

    Any ideas how I could fix that?

  4. Till Krüss
    Plugin Author

    Posted 3 years ago #

    I'm not sure if I understand your setup fully. Could you post the code where the mailto-link is printed?

  5. Matthias
    Posted 3 years ago #

    Do you mean the html output or the page.php (and the shortcodes.php)?

  6. Till Krüss
    Plugin Author

    Posted 3 years ago #

    Your "page.php", and please use something like pastebin.com.

  7. Matthias
    Posted 3 years ago #

    On the page there is a lot of static content/text. And in between two of the text blocks, there should be all the posts of a given category. I thought the simplest way to do this is a shortcode that displays those posts.



    shortcodes.php (the used snippet for the post listing)

    ...sorry for the troubles.

  8. Till Krüss
    Plugin Author

    Posted 3 years ago #

    Looks good. Where exactly is the mailto-link printed that doesn't get encoded? aaa_show_posts()?

    Could you check the result of the page without using Firebug, Web Inspector or Dragonfly, because they decode decimal/hexadecimal entities into plain text. To make sure your email address is encoded, right-click/secondary-click the page, click "View Source", "View Page Source" or "Source" and search for the plain text email address.

  9. Matthias
    Posted 3 years ago #

    No, it's somewhere underneath the part with the aaa_show_posts() shortcode.

    I checked the source code. When the shortcode is not placed on the page, everything is fine (read: your plugin works like a charm). But as soon as I put this shortcode somewhere on the page (doesn't matter if it's above or underneath the email link), the mail link isn't encoded anymore.

    Guess I have to re-write my shortcode somehow...

  10. Till Krüss
    Plugin Author

    Posted 3 years ago #

    Could you drop me a line?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Email Address Encoder
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.