Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author chriswgerber

    (@chriswgerber)

    Hi spin_linda,

    To implement tags in the header, you would need to edit your theme or child theme files to allow for a widget to appear in that slot or to run a function directly in that spot.

    dfp_get_ad_position_by_name( $title ) will pull in an ad position based on the title.

    If you wanted to prevent the display of the ad on smaller devices, you would need to include custom CSS to hide those positions or all positions. For example:

    @media (max-width: whatever-your-width-is) {
        .dfp_ad_pos {
            display: none;
        }
    }

    Adding that to Jetpack custom CSS or to your theme’s/child theme’s style.css will had all ad positions on screens smaller than whatever you set the width to be.

    Thread Starter spin_linda

    (@spin_linda)

    wow, thank you for the fast reply.
    So what i do, is to place dfp_get_ad_position_by_name( $title ) in the header.php i replae title with my placement name? Sorry for asking stupid questions but im not that familiar with code.

    Plugin Author chriswgerber

    (@chriswgerber)

    Yes. Here’s an example snippet of code. I have a position titled “Website_ROS_Header” that I want to display within the header.

    First I call the position to a variable. Then I run the position display it where I want it to display by calling $header_position->display_position();.

    <?php
    $header_position = dfp_get_ad_position_by_name( 'Website_ROS_Header' );
    ?>
    <header>
        <div class="header-ad">
            <?php $header_position->display_position(); ?>
        </div>
    </header>
    Thread Starter spin_linda

    (@spin_linda)

    That worked great. And one more question, if i want to assign that slot to
    the center of page`, how do i specify that particular spot?

    Thread Starter spin_linda

    (@spin_linda)

    That worked great. And one more question, if i want to assign that slot to
    the center of page`, how do i specify that particular spot?

    Plugin Author chriswgerber

    (@chriswgerber)

    This is a bit tricky as other css on the page can get in the way, and sometimes things are sized or positioned awkwardly and it makes it harder to correctly position.

    You mean if you want to center it on the page? You would need to target the ad position again with css and set the margin to auto.

    Example for position titled “Website_ROS_Header”:

    #ad_pos_website_ros_header {
        margin: auto;
    }

    Thread Starter spin_linda

    (@spin_linda)

    thank you.

    What i had to do is to set the magin left. so now it looks great.

    Great plug-in!!!

    Plugin Author chriswgerber

    (@chriswgerber)

    Glad I could help. Thanks for the kind words!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Integrate with header’ is closed to new replies.