WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Matthias
    Member
    Posted 1 year 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.

    e.g.
    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?

    Cheers,
    Matthias

    http://wordpress.org/extend/plugins/email-address-encoder/

  2. Till Krüss
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year 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>';
        endwhile;
    endif;
    
    wp_reset_query();
    return $return_string;

    Any ideas how I could fix that?

  4. Till Krüss
    Member
    Plugin Author

    Posted 1 year ago #

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

  5. Matthias
    Member
    Posted 1 year ago #

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

  6. Till Krüss
    Member
    Plugin Author

    Posted 1 year ago #

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

  7. Matthias
    Member
    Posted 1 year 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.

    page.php
    http://pastebin.com/GHAgeDcc

    content-page.php
    http://pastebin.com/rJRxkJxp

    shortcodes.php (the used snippet for the post listing)
    http://pastebin.com/RBG36dSK

    ...sorry for the troubles.

  8. Till Krüss
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Plugin Author

    Posted 1 year ago #

    Could you drop me a line?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.