• Resolved Umrah

    (@umrah)


    I am running a technology blog https://www.clicktechblog.com and I just want to know how do I insert an ad banner in the header top right-hand corner of my theme. I know my theme wasn’t built that way but I would love to have an ad there especially in my posts.

    Any help will be gladly appreciated.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • It looks like you’ve already been able to add an ad banner at the top of your page.

    I would suggest creating a child theme so you can edit your posts template to add your ad banner for your posts.

    Or you can try searching for a solution in the below support pages available for your theme:

    Thread Starter Umrah

    (@umrah)

    Thanks Adeline. Yeah I found out when I watch a Youtube video on how to do it.

    I created a child theme already but I don’t know where and how to add these codes in the child theme.

    Have you tried adding your single.php file from your parent theme to your child theme? Check out the template hierarchy single post. Then once you’ve copied it to your child theme, add your ad banner details in the appropriate location within that file.

    However reading back through your initial question, I doubt you would be able to add this to your “header top right-hand corner of your theme” as blog posts generally sit after your logo, navigation, etc..

    Thread Starter Umrah

    (@umrah)

    Thanks again Adeline it worked but the ad is below the logo and navigation as you said. I think I will let it stay there and see how it perform.

    Thanks.

    insert an ad banner in the header top right-hand corner of my theme

    Do you want this above or below the menu on the right-hand side?

    If so, you would have to add a full-width “div” to the theme’s “Theme Header (header.php)” template which you must copy and add to your child theme. This would increase the height of the header, though.
    Do you want this in the header on all pages and posts or just on the home page?
    What is the size of the ad banner, because when viewing on smaller devices, the banner would have to be styled responsive?

    Thread Starter Umrah

    (@umrah)

    Thanks for your help @neotechnomad. I will work with it in the center for now but you can let me know how to do it for future reference.

    Okay I’ll copy the header.php to my child theme. One concern though, if there is a theme upgrade, will this affect any configuration made?

    Yeah I want it on all pages and posts.

    Well actually I’m using a responsive ad and I tested it on my iPhone and it seems okay. Not sure about other devices.

    Okay I’ll copy the header.php to my child theme. One concern though, if there is a theme upgrade, will this affect any configuration made?

    None whatsoever. This is what a child theme is for, to modify the theme without touching it, and when the theme updates, the alterations remain.

    I will work with it in the center for now but you can let me know how to do it for future reference.

    It is basically a full-width div with the image inside it and the css of “text-align: right” so the image stays on the right of the div.
    It is set inside the “container” above the “nav”.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How do I insert an ad banner in the header of my theme’ is closed to new replies.