Skip to content

Commit

Permalink
Carrying the echo var through for the short-code implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvent22 committed May 31, 2016
1 parent aba3ab4 commit d1eaec5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions php/ad-servers/class-ad-layers-ad-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ public function get_ad_units() {
*
* @access public
*/
public function get_ad_unit( $ad_unit ) {
public function get_ad_unit( $ad_unit, $echo = true ) {
if ( ! empty( $this->ad_server ) ) {
$this->ad_server->get_ad_unit( $ad_unit );
$this->ad_server->get_ad_unit( $ad_unit, $echo );
}
}

Expand Down
5 changes: 4 additions & 1 deletion php/class-ad-layers-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public function do_ad_unit( $atts, $content, $tag ) {
// Attempt to display the specified ad unit.
// This will just do nothing if the unit is invalid
// or doesn't exist in the current ad layer.
return Ad_Layers_Ad_Server::instance()->get_ad_unit( $atts['unit'] );
// Since the WP shortcode pattern is running and trying to replace
// our shortcode, we need to return the ad and what to replace there,
// so we set the echo value to false for get_ad_unit.
return Ad_Layers_Ad_Server::instance()->get_ad_unit( $atts['unit'], false );
}
}

Expand Down

0 comments on commit d1eaec5

Please sign in to comment.