I'm using Divi and need to add content via a Divi hook, via code in functions.php in my child theme. I'm testing the basics, and this code puts things before the main content:

function bgt_add_conditional_code_to_event_pages () { 

echo do_shortcode('[et_pb_section  _builder_version="4.9.3" _module_preset="default"][et_pb_row _builder_version="4.9.3" _module_preset="default"][et_pb_column _builder_version="4.9.3" _module_preset="default" type="4_4"][et_pb_text _builder_version="4.9.3" _module_preset="default"]');
echo "<h1>This is a test</h1>";
echo do_shortcode('[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]');


add_action( 'et_before_main_content', 'bgt_add_conditional_code_to_event_pages' );

But! I want it to display AFTER the main content. Yet when I change to 'et_after_main_content'... nothing.

I can't imagine what I'm doing wrong! Hope someone can advise.

1 Answer 1


I hope you're doing well! I wonder if adding a priority to your filter would fix the issue. In the past I've had filters not fire because the default priority was too high or low. Could you try something like this:

add_action( 'et_after_main_content', 'bgt_add_conditional_code_to_event_pages', 9999 );

And see if that resolves the issue? From what I read in the divi documentation the way you're going about it should work I think.

  • Thanks Kenny - I had high hopes for this solution but it doesn't seem to do a thing (and I tried low and high numbers...) Commented May 22, 2021 at 23:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.