Does not work with Divi-Theme?
-
Hi Till,
Thank your for this plugin! I just noticed that it does not work on a website of mine where I am using the Divi-Theme by Elegant Themes. On this page for example it works:
http://p238157.webspaceconfig.de/project/anfahrt-und-kontaktadressen/
But not on this one:
http://p238157.webspaceconfig.de/impressum/
Both pages are build with the Divi Page Builder so I am not sure why ist works on some pages and not on others. Any idea?
Thank you,
Bogdan
-
What exactly are you referring to, that working on the first link, but not the second?
Hi Till,
Thank you for your fast reply. Well in the first page the email addresses are encoded when I look into the HTML source but not on the second page.
Thanks,
BogdanAh, right, sorry. I just confused with a different plugin.
I don’t have access to the Divi theme, but it looks like that the content on the 2nd links does not have the
the_contentfilters applied.I’d recommend you to contact the Divi support team and ask which filter is applied to all of their content blocks and then add it manually:
add_filter( 'some_divi_filter', 'eae_encode_emails' );Thank you Till, I will try this.
Oddly enough, just running it through the_content filter was enough to get it working with Divi.
add_filter( 'the_content', 'eae_encode_emails' );Ah, maybe Divi does something funky with
the_content()and this plugins filter priority of1000is too high, you can adjust it using theEAE_FILTER_PRIORITYconstant.I got this reply from the Elegant Themes Support:
I see, thank you.
Yes, page builder does not use the_content () function, bc it’s not possible via shortcodes. Bc you can use many text module on a page and if you use the_content () then it will display the same content all for all the text modules. So page builder uses custom function for that. The functions is located on line 2371. Here is itdo_shortcode( et_pb_fix_shortcodes( $content ) )
So, I’m not sure if that’s possible to fix it at all. If your plugin supports shortcodes then maybe there is a work around, but I think the plugin does not work for shortcodes. You can contact plugin support again to ask about it. Thanks
@blue Liquid Designs: Thank you, this worked for me, too!
Hey Bogdan,
please ask the Elegant Themes Support if they provide a filter that is applied to the page/widget contents.
Cheers!
Hello Guys,
My other solution for Divi was to put the
<?php $et_email = eae_encode_emails($et_email);?>
code to the header.php, right after the line:
<?php if ( ” !== ( $et_email = et_get_option( ‘header_email’ ) ) ) : ?>
I hope it helps.Also my question, where do you put the aforementioned add_filter( ‘the_content’, ‘eae_encode_emails’ ); code in the solution above?
Thanks,
MarkHey Mark!
If it’s a custom theme, you could put it in your theme’s
functions.php, but if it’s a 3rd-party theme (like Divi) changes to that that file will lost on each theme update. In that case I recommend to use a Must Use Plugin.Same applies to your solution of adding
eae_encode_emails()toheader.php. Every theme update will undo that. If you post the source code ofet_get_option(), I might be able to find a filter, so you can solve this permanently.Hi Till,
Thanks for your reply!
Interestingly putting that into functions.php with Divi brakes the theme: it just doesn’t work, I get a white screen.
I use a child-theme, so my changes won’t disappear with the updates, however I like you solution suggestion better, here is the code from custom-functions.phpCheers,
Mark
if ( ! function_exists( ‘et_get_option’ ) ){
function et_get_option( $option_name, $default_value = ”, $used_for_object = ” ){
global $et_theme_options, $shortname;if ( et_options_stored_in_one_row() ){
$et_theme_options_name = ‘et_’ . $shortname;if ( ! isset( $et_theme_options ) ) $et_theme_options = get_option( $et_theme_options_name );
$option_value = isset ( $et_theme_options[$option_name] ) ? $et_theme_options[$option_name] : false;
} else {
$option_value = get_option( $option_name );
}// option value might be equal to false, so check if the option is not set in the database
if ( ! isset ( $et_theme_options[$option_name] ) && ” != $default_value ) {
$option_value = $default_value;
}if ( ” != $used_for_object && in_array( $used_for_object, array( ‘page’, ‘category’ ) ) && is_array( $option_value ) )
$option_value = et_generate_wpml_ids( $option_value, $used_for_object );return $option_value;
}
}Hey Mark,
the
et_get_option()sadly doesn’t use any filters we can hook into. Pity.However the
functions.phpof your child theme is a great place to add customizations. If you get a “white screen of death”, just enableWP_DEBUGin yourwp-config.phpto see what’s exactly causing the fatal error.@bogdan: Is it still working with the actual version of DIVI on your site?
The topic ‘Does not work with Divi-Theme?’ is closed to new replies.