Search code examples
wordpresswordpress-plugin-creation

How to add div at the end of header in wordpress with php code


I am creating a plugin and I want to create a full-width div at the bottom of the header. I tried wp_head action but it is adding the div at the top of the header. The question is how can i add a div at the bottom/end of header with php code? Is there any wordpress hook or filter which I can use? Thanks in advance.

Currently, it appears like this.

enter image description here

But I want to move the breaking section below the header.


Solution

  • Actually, there is no available WordPress hook that will run right after the WordPress header.php loads.

    I implemented this by appending the HTML code below the header using javascript.

    You can find the code here. https://github.com/AwaisTheDev/wordpress_breaking_news_plugin/blob/main/includes/load-widget-frontend.php#L82