I want to add a widget to my wordpress site, but i can't see it in the back-end of wordpress. I know that i am doing something wrong. The template doesent have a header.php and a footer.php

I did put the widget in the functions.php but then i want the header.php. In the header.php i want the widget to appear on the header ofcource.

  • Where did you download the theme from? If you check their official GitHub repository, header.php and footer.php do exist – kero Apr 4 '18 at 13:13
  • 2
    If you created the child theme yourself, just copy the parent theme's files. You only put files into the child theme that you are actively overriding. – WebElaine Apr 4 '18 at 13:18

If you're using a child theme you won't necessarily have header.php and footer.php. If you don't have them then the parent theme's header.php and footer.php are used.

If you want to make a change to either of those templates you need to copy the file from the parent theme (presumably called understrap) into your child theme and make the modifications to the child theme version.

  • The child theme i have. Its allready created and directly downloaded from the internet. I dont think it has a parent theme – Mustafa Dennis Uslu Apr 4 '18 at 13:07
  • 1
    That doesn't really make any sense. Check your wp-content/themes folder. – Jacob Peattie Apr 4 '18 at 13:12

Child-themes ( as the name suggest ) are based on their respective parent theme. A child-theme requires only a small group of files to work, all other dependant files will be pulled from the parent. To change, and or overwrite such a file you will have to create it. This however will cause the theme to NOT load the file from the parent theme, so its wise to check this beforehand. For instance, if you want to edit the header.php file, you duplicate it from your parent theme into your child-theme, the theme will now load header.php from the child theme, not from the parent theme. Plugins such as What the file can help you locate template parts and such. https://nl.wordpress.org/plugins/what-the-file/

Your Answer

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

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