• Resolved Matthias

    (@digitalcult)


    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/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    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?

    Thread Starter Matthias

    (@digitalcult)

    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?

    Plugin Author Till Krüss

    (@tillkruess)

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

    Thread Starter Matthias

    (@digitalcult)

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

    Plugin Author Till Krüss

    (@tillkruess)

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

    Thread Starter Matthias

    (@digitalcult)

    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.

    Plugin Author Till Krüss

    (@tillkruess)

    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.

    Thread Starter Matthias

    (@digitalcult)

    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…

    Plugin Author Till Krüss

    (@tillkruess)

    Could you drop me a line?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Does not encode link with custom text’ is closed to new replies.