Permalink
Browse files

Merge pull request #79 from Automattic/shortcode

Shortcodes should return not echo
  • Loading branch information...
2 parents 6f76bdf + ff7895e commit f69dad67b063b20d733c1c3812eaff32e800c5bf @rinatkhaziev rinatkhaziev committed Jun 18, 2013
Showing with 9 additions and 5 deletions.
  1. +8 −4 ad-code-manager.php
  2. +1 −1 readme.txt
View
@@ -834,8 +834,9 @@ function register_ad_codes( $ad_codes = array() ) {
* @uses do_action( 'acm_tag, 'your_tag_id' )
*
* @param string $tag_id Unique ID for the ad tag
+ * @param bool $echo whether to echo or return ( defaults to echo )
*/
- function action_acm_tag( $tag_id ) {
+ function action_acm_tag( $tag_id, $echo = true ) {
/**
* See http://adcodemanager.wordpress.com/2013/04/10/hi-all-on-a-dotcom-site-that-uses/
*
@@ -876,8 +877,11 @@ function action_acm_tag( $tag_id ) {
*/
$output_html = apply_filters( 'acm_output_html_after_tokens_processed', $output_html, $tag_id );
- // Print the ad code
- echo $output_html;
+ if ( $echo )
+ // Print the ad code
+ echo $output_html;
+ else
+ return $output_html;
}
/**
@@ -1067,7 +1071,7 @@ function shortcode( $atts ) {
if ( empty( $id ) )
return;
- $this->action_acm_tag( $id );
+ return $this->action_acm_tag( $id, false );
}
}
View
@@ -2,7 +2,7 @@
Contributors: rinatkhaziev, jeremyfelt, danielbachhuber, carldanley, zztimur, automattic, doejo
Tags: advertising, ad codes, ads, adsense, dfp, doubleclick for publishers
Requires at least: 3.1
-Tested up to: 3.6-beta1
+Tested up to: 3.6-beta3
Stable tag: 0.4.2
Manage your ad codes through the WordPress admin in a safe and easy way.

0 comments on commit f69dad6

Please sign in to comment.