Home>Support>Add #mydiv in every #primary theme php files

Add #mydiv in every #primary theme php files

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

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 !

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 10 years, 1 month ago Support Assistants

    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.

  2. 10 years, 1 month ago yohann

    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 :

    <div id="primary" class="content-area">
    	<div id="dreux-left"></div>
    (...)
  3. 10 years, 1 month ago Support Assistants

    Thanks :)

    header.php contains the following action hook

    <?php do_action( 'vantage_main_top' ); ?>

    . So, using a child theme functions.php file we can use that hook as follows:

    /**
     * Add HTML
     */
    function vantage_child_main_top() {
    	echo '<div id="dreux-left"></div>';
    }
    add_action( 'vantage_main_top', 'vantage_child_main_top' );

    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.

  4. 10 years, 1 month ago yohann

    I’m so fan of your work :p

    Smooth and working

    Thanks !

  5. 10 years, 1 month ago Support Assistants

    We’re really glad to hear that helped. All the best with your website :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More