0

I would like to add a top bar to wordpress without having to edit any theme files. Are there any filters that I can use to achieve this.

I want to be able to do this in the function.php file. This way it is easy to just dump in the code in the future without having to worry about changing the code in the theme files.

If there are no filters that can do this then I will use the header.php file in a child theme to do make the changes.

11
  • 1
    depends on your theme. at least the latest default themes 'Twenty...' now have wp_body_open(); just inside the body tag.
    – Michael
    May 24 '20 at 2:12
  • You could also do it via plugin and place it somewhere in the footer, but then displace the rest of the content with positioning... ..this could get tricky with some themes though. May 24 '20 at 3:48
  • it would be nice if you mention the theme you use so that we can help you with code May 24 '20 at 6:48
  • @Michael, that allows you to edit at the beginning of the body tag. This may be desirable but doesn't explicitly allow one to edit the beginning of the header navigation which is a more foolproof solution. It appears there is no filter for what I am asking about. May 24 '20 at 17:01
  • @TonyDjukic, sorry should have said that I am looking for a solution without having to install additional plugins. May 24 '20 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.