This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Copying Header.php to Child Theme to incorporate BuySellAds code

  • Creator
    Topic
  • #7428
    jnapier
    Participant

    I was just curious if I can copy my Header.php file to my child theme and make some changes for advertisements there?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #7430
    Jason Bobich
    Keymaster

    Hello,

    You can copy header.php to your Child theme, but it’s better to avoid this if you can. There’s a higher chance that this will cause problems for you later when updating the theme. There really shouldn’t be any reason you’d need to do this, though, because any content you want add into the header you can hook to one of the actions.

    http://dev.themeblvd.com/tutorial/actions/

    http://dev.themeblvd.com/tutorial/primary-framework-action-hooks/

    Also, outside of making code customizations, did you see that you have widget area both above the header and above the content you can put advertisements in from Appearance > Widgets? That’s another option, as well.

    #7435
    jnapier
    Participant

    Yes I know that and love that feature. What this is for is the following

    Step 1
    Install this main snippet ONCE, right below the opening tag. If you have already installed the code below, please skip to step 2.

    (function(){
    var bsa = document.createElement(‘script’);
    bsa.type = ‘text/javascript’;
    bsa.async = true;
    bsa.src = ‘http://s3.buysellads.com/ac/bsa.js’;
    (document.getElementsByTagName(‘head’)[0]||document.getElementsByTagName(‘body’)[0]).appendChild(bsa);
    })();


    Step 2
    Background Skins must encompass your page. Install this opening tag immediately below the ad code from above.

    Step 3
    Now, install the closing tag immediately before the closing tag.

    #7437
    Jason Bobich
    Keymaster

    So, have a peak at header.php. You’ve got an action hook right there after the <body> tag as your instructions say — “themeblvd_before”

    function my_buysell_ads(){
    	?>
    	your buy sell ads code ...
    	<?php
    }
    add_action('themeblvd_before', 'my_buysell_ads');

    Or how about something like this? http://wordpress.org/extend/plugins/buysellads/

    … Then you could just put your ads into one of the theme’s widget areas, and you don’t have to worry about any code customizations.

    #7438
    jnapier
    Participant

    Ha, wish they would have mentioned the plugin on the site lol. I will play around with both.

    #7843
    jnapier
    Participant

    I have the action hook working from above, but am having issues with the following. Do you know how/where I can install the following?

    Step 2
    Background Skins must encompass your page. Install this opening tag immediately below the ad code from above.

    Step 3
    Now, install the closing tag immediately before the closing tag.

    #7849
    Jason Bobich
    Keymaster

    How do you think you might accomplish these two things?

    #7893
    jnapier
    Participant

    Likely by using an action hook. I am just not sure. Another option would be to upload the footer.php file into the Child theme I believe.

    I think the step 2 can be put in with the first action hook directly under it, but I am not sure.

    #7895
    Jason Bobich
    Keymaster

    I think the step 2 can be put in with the first action hook directly under it, but I am not sure.

    Yup, I’d agree. You already have a block of code you’re inserting. So, why not just put your next bit of code along with it? No need to over think it.

    Another option would be to upload the footer.php file into the Child theme I believe.

    Yup, again you’ve got an action hook at the very bottom of the document you can use. Take a look again at the actions map in your developer documentation:

    http://dev.themeblvd.com/tutorial/primary-framework-action-hooks/

    Or better yet, just open up footer.php, look, and see what action hooks sit just before the closing body tag.

    Then, just use the same method you’re using with steps 1 & 2, to hook a new function to that action hook.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.