Skip to content

Helper Functions

WB Ad Manager defines a few global PHP helpers you can call from a theme template or another plugin.

wbam_display_ad( $ad_id, $options = array() )

Section titled “wbam_display_ad( $ad_id, $options = array() )”

Returns the rendered HTML for one ad by ID.

echo wbam_display_ad( 123 );
Parameter Type Description
$ad_id int The ad post ID
$options array Optional display options passed to the placement engine

Returns the array of ads eligible for a given placement.

$ads = wbam_get_ads( 'header' );
Parameter Type Description
$placement_id string A placement ID (see Placements)

Returns the main plugin instance, from which you can reach the placement engine and other subsystems.

$engine = wbam()->placements();

If you prefer shortcodes in templates:

echo do_shortcode( '[wbam_ad id="123"]' );