Hello,
I have a question about adding a div #mydiv in every theme php file under #primary div like this
.
When I had the free vantage theme, I added this div in multiple php files and when I upgraded to vantage premium, my php files were overwritten so I would like to know how can I add this div without editing php files. The php files could be overwritten in a next update and I don’t want to lose my work again.
I’m new to wordpress functions and APIs if you could help me do this simple task ?
Thanks !
Hi Yohann
Thanks for your support.
All WordPress themes completely overwrite their own folder during theme updates. To safely edit a theme file/s you’ll need to use a child theme.
Perhaps, let us know why you need to add this div. We might be able to suggest an alternative solution that doesn’t require editing theme files.
I would like to add a div in position:absolute that will contain a background image set in css.
This div should be placed in #primary div and #primary has a new css attribute: position:relative
Do you have an idea how to do that without editing a php file ?
I made an example on this page to show you how I did it: -http://tongfils.ambidev.com/articles/
Simply by adding to index.php theme the #dreux-left div :
Thanks :)
header.php contains the following action hook
. So, using a child theme functions.php file we can use that hook as follows:
We’ve prepared the child theme for you, download it here: https://siteorigin.com/wp-content/uploads/2015/12/vantage-child-yohann.zip
Hopefully, you find this helpful.
I’m so fan of your work :p
Smooth and working
Thanks !
We’re really glad to hear that helped. All the best with your website :)