Title: Echo in PHP
Last modified: May 3, 2017

---

# Echo in PHP

 *  Resolved [aznwhiteshark](https://wordpress.org/support/users/aznwhiteshark/)
 * (@aznwhiteshark)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/echo-in-php/)
 * Hi there,
 * I was wondering how we would be able to place an ad through a page template?

Viewing 1 replies (of 1 total)

 *  [The INN Nerds](https://wordpress.org/support/users/inn_nerds/)
 * (@inn_nerds)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/echo-in-php/#post-9095529)
 * There’s two ways to do it.
 * The first way:
    - Register a widget area with the [register_sidebar function](https://codex.wordpress.org/Function_Reference/register_sidebar)
      in your theme
    - In your template, display the sidebar by calling [dynamic_sidebar](https://codex.wordpress.org/Function_Reference/dynamic_sidebar)
      using the name of the widget area you registered.
    - Add a DoubleClick for WordPress widget to the sidebar through the Dashboard
      or the Customizer.
 * For more about this method, see the WordPress [Codex article on sidebars](https://codex.wordpress.org/Sidebars).
 * The other way, which is not recommended or supported by INN, is to call [`the_widget( $widget, $instance, $args )`](https://codex.wordpress.org/Function_Reference/the_widget)
   and pass the following arguments:
 * `$widget`: `DoubleClick_Widget`
 * `$instance` = array(
    ‘identifier’ => ‘your ad code from DFP’, ‘sizes’ => array(//
   an array of strings with breakpoint identifier => a string containing a comma-
   separated list of ad sizes valid between that breakpoint and the next-largest//
   get valid versions of this array by examining the widget when the plugin is configured),‘
   lazyLoad’ => true, ‘title’ => ‘Optional widget title’ )
 * `$args`: see [https://codex.wordpress.org/Function_Reference/the_widget](https://codex.wordpress.org/Function_Reference/the_widget)
    -  This reply was modified 8 years, 11 months ago by [The INN Nerds](https://wordpress.org/support/users/inn_nerds/).
      Reason: formatting
    -  This reply was modified 8 years, 11 months ago by [The INN Nerds](https://wordpress.org/support/users/inn_nerds/).
      Reason: formatting
    -  This reply was modified 8 years, 11 months ago by [The INN Nerds](https://wordpress.org/support/users/inn_nerds/).
      Reason: formatting

Viewing 1 replies (of 1 total)

The topic ‘Echo in PHP’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/doubleclick-for-wp_00af92.svg)
 * [Super Cool Ad Manager Plugin](https://wordpress.org/plugins/doubleclick-for-wp/)
 * [Support Threads](https://wordpress.org/support/plugin/doubleclick-for-wp/)
 * [Active Topics](https://wordpress.org/support/plugin/doubleclick-for-wp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/doubleclick-for-wp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/doubleclick-for-wp/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [The INN Nerds](https://wordpress.org/support/users/inn_nerds/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/echo-in-php/#post-9095529)
 * Status: resolved