array_ad_conditions.php
10 years ago
cap_map.php
10 years ago
functions.php
11 years ago
load_modules.php
9 years ago
functions.php
80 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * functions that are directly available in WordPress themes (and plugins) |
| 5 | */ |
| 6 | |
| 7 | /** |
| 8 | * return ad content |
| 9 | * |
| 10 | * @since 1.0.0 |
| 11 | * @param int $id id of the ad (post) |
| 12 | * @param arr $args additional arguments |
| 13 | */ |
| 14 | function get_ad($id = 0, $args = array()){ |
| 15 | return Advanced_Ads_Select::get_instance()->get_ad_by_method( $id, 'id', $args ); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * echo an ad |
| 20 | * |
| 21 | * @since 1.0.0 |
| 22 | * @param int $id id of the ad (post) |
| 23 | * @param arr $args additional arguments |
| 24 | */ |
| 25 | function the_ad($id = 0, $args = array()){ |
| 26 | echo get_ad( $id, $args ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * return an ad from an ad group based on ad weight |
| 31 | * |
| 32 | * @since 1.0.0 |
| 33 | * @param int $id id of the ad group (taxonomy) |
| 34 | * |
| 35 | */ |
| 36 | function get_ad_group($id = 0){ |
| 37 | return Advanced_Ads_Select::get_instance()->get_ad_by_method( $id, 'group' ); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * echo an ad from an ad group |
| 42 | * |
| 43 | * @since 1.0.0 |
| 44 | * @param int $id id of the ad (post) |
| 45 | */ |
| 46 | function the_ad_group($id = 0){ |
| 47 | echo get_ad_group( $id ); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * return content of an ad placement |
| 52 | * |
| 53 | * @since 1.1.0 |
| 54 | * @param string $id slug of the ad placement |
| 55 | * |
| 56 | */ |
| 57 | function get_ad_placement($id = ''){ |
| 58 | return Advanced_Ads_Select::get_instance()->get_ad_by_method( $id, 'placement' ); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * return content of an ad placement |
| 63 | * |
| 64 | * @since 1.1.0 |
| 65 | * @param string $id slug of the ad placement |
| 66 | */ |
| 67 | function the_ad_placement($id = ''){ |
| 68 | echo get_ad_placement( $id ); |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * return true if ads can be displayed |
| 73 | * |
| 74 | * @since 1.4.9 |
| 75 | * @return bool, true if ads can be displayed |
| 76 | */ |
| 77 | function advads_can_display_ads(){ |
| 78 | return Advanced_Ads::get_instance()->can_display_ads(); |
| 79 | } |
| 80 |