Hook Right After Header

Hello,

I want to put content right after the header via a hook. Is there a hook right after the header? I tried all of the hooks in this article, but none of them did work.

Maybe with this: x_after_view_{$file}

But I couldn’t get that to work either.

Hi Matthias,

Thanks for writing in! Do you want to add a code after opening <body> tag? If so try following the code below and add it into your child theme’s functions.php file.

// Add custom code after body tag

function my_custom_code() { 
  // Add your custom code here
}

add_action('x_before_site_begin', 'my_custom_code');

Hope that helps.

1 Like

Hello @mldarshana,

thank you for replying. I was looking to add a slider right after the menu. I managed to achieve that with this hook: x_after_view_header_base

I actually found a really nice plugin that shows you all the available hooks, called “Simply Show Hooks”. Hasn’t been updated for 3 years but seems to work well :slight_smile:

Hi,

Thanks for letting us know about the plugin.

Have a nice day! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.