Example #1
0
 /**
  * shortcode to include ad from an ad group in frontend
  *
  * @since 1.0.0
  * @param arr $atts
  */
 public function shortcode_display_ad_group($atts)
 {
     $id = isset($atts['id']) ? (int) $atts['id'] : 0;
     // use the public available function here
     return get_ad_group($id);
 }
Example #2
0
 /**
  * return content of an in a widget
  *
  * @since 1.2
  * @param string $id slug of the display
  */
 static function output($id = '')
 {
     // get placement data for the slug
     if (empty($id)) {
         return;
     }
     $item = explode('_', $id, 2);
     if (isset($item[1])) {
         $item_id = $item[1];
     } elseif (empty($item_id)) {
         return;
     }
     // return either ad or group content
     if ($item[0] == 'ad') {
         return get_ad(absint($item_id));
     } elseif ($item[0] == 'group') {
         return get_ad_group(absint($item_id));
     } elseif ($item[0] == 'placement') {
         return get_ad_placement($item_id);
     }
     return;
 }
/**
 * echo an ad from an ad group
 *
 * @since 1.0.0
 * @param int $id id of the ad (post)
 */
function the_ad_group($id = 0)
{
    echo get_ad_group($id);
}