Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Crssp

    (@crssp)

    It would be great if the theme header ad script field box. could process a shortcode, but that was the first thing I tried, and that didn’t work.
    Perhaps that could be changes so this field box would process a shortcode, but that would be something that likely broke every time the theme was updated, and a child theme is not an option.
    Just offering that up also, a shortcode allow solution would be awesome too.

    Thread Starter Crssp

    (@crssp)

    I got a reply from my themes support team, saying the latest version of the theme already works with shortcodes, but otherwise swap in this line of code in the header.php file.

    change:
    echo '<div class="header-banner-image" >' . $banner_script . '</div>';
    
    to:
    echo '<div class="header-banner-image" >' . do_shortcode($banner_script) . '</div>';

    Maybe there’s something better, but this should work, planning to test now.

    Thread Starter Crssp

    (@crssp)

    This worked a charm. Very clean solution, we still can use a shortcode in our header banner script custom field box, and it worked easy peasy.
    Ahhh the power of do_shortcode()

    Inserting raw PHP code into that box may have worked, but would that have been a security concern, maybe? Any suggestions or discussion points appreciated.
    thanks.

    Plugin Author chriswgerber

    (@chriswgerber)

    I’ll look into other ways. You could drop the ad position into somewhere else (using a widget or otherwise) and copy the HTML/JS that is created to paste it into the box. It’s a hacky way to do it, but if the theme author supports shortcode in the boxes, you could use that instead.

    Glad you found a solution.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add DFP position as ad code script or html, via theme option field?’ is closed to new replies.