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

    (@tillkruess)

    Yes, have a look at the FAQ. You probably want to use the walker_nav_menu_start_el filter.

    Hi,
    In wp-content/plugins/email-address-encoder/email-address-encoder.php I’ve changed the line :
    foreach (array('the_content', 'the_excerpt', 'widget_text', 'comment_text', 'comment_excerpt') as $filter) {
    with
    foreach (array('walker_nav_menu_start_el', 'the_content', 'the_excerpt', 'widget_text', 'comment_text', 'comment_excerpt') as $filter) {
    and it seems to work fine.
    Thanks to Til 🙂

    Plugin Author Till Krüss

    (@tillkruess)

    Your code change won’t survive a plugin update, it’s better to add your own custom filter:

    add_filter( 'walker_nav_menu_start_el', 'eae_encode_emails' );

    Ok, I just discover how to use add_filter 🙂
    So I’ve copy back email-address-encoder.php.sav to email-address-encoder.php. And since I use Responsive theme from CyberChimps, here is how I customize my wp-content/themes/responsive-child-theme/header.php file.
    Before :

    <div id="container" class="hfeed">
    
                <?php get_sidebar('top'); ?>
                    <?php wp_nav_menu(array(
                        'container'       => '',
                        'theme_location'  => 'header-menu')
                        );
                    ?>

    After :

    <div id="container" class="hfeed">
    
    <?php add_filter( 'walker_nav_menu_start_el', 'eae_encode_emails' ); ?>
    
                <?php get_sidebar('top'); ?>
                    <?php wp_nav_menu(array(
                        'container'       => '',
                        'theme_location'  => 'header-menu')
                        );
                    ?>

    Seems to work fine too.
    Is it the right way ?

    Plugin Author Till Krüss

    (@tillkruess)

    That’s okay, but even better would be if you’d place the add_filter() code in a Must Use Plugin. That’s independent code and won’t be removed during plugin/theme updates.

    Wow! What educational plugin, I didn’t know mu-plugins before 😉
    So I created a file wp-content/mu-plugins/addfilter-eae.php with this code inside :

    <?php add_filter( 'walker_nav_menu_start_el', 'eae_encode_emails' ); ?>

    And it just works like a charm.
    Many thanks Till!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Encode Mail-Adress in Menu’ is closed to new replies.