plugin-icon

Taro Ad Fields

作者:TAROSKY INC.·
Advertise block manager for WordPress.
版本
1.3.5
活跃安装
10
最后更新
Apr 23, 2025
Taro Ad Fields

You can create ad slot for you WordPress theme. In each position, the latest ad field will be displayed. You can manage your advertisement’s schedule & display!

From Theme

Call action hook in your theme:

<?php do_action( 'taro_ad_field', 'after-header', '<div class="after-header">', '</div>', 3 ); ?>

In this place, the latest 3 ads will be displayed. With Taro Clockwork Post plugin, you can let your ad be automatically expired.

Hook Arguments

do_action( $hook_name, $slug, $before, $after, $number );>
  1. $hook_name: The action hook name. Always should be taro_ad_field.
  2. $slug: Slug of position.
  3. $before: String to be output just before ad block. If no ad exists, this won’t be displayed.
  4. $after: String to be output just after ad block.
  5. $number: Number of ad to be displayed. Default is 1.
  6. $contexts: Array of contexts. Context is a taxonomy that filters ads. For more details, see our Wiki.

From Widget

We also have widget for ad field. The latest ad of specified position will be displayed in the widget.

Set Default Positions

In your theme, add filter hook for taf_default_positions. These terms will be created automatically.

add_filter( 'taf_default_positions', function() { return [ 'after-header' => [ 'name' => 'After Header', 'description' => 'Displayed just after header.', ], 'after-content' => [ 'name' => 'After Content', 'description' => 'Displayed just after content.', 'mode' => 'iframe', ], ]; } );

Defaults are empty array, so no default position. You can add new position to them with filter hook like above. The structure of array will be like below:

[ 'slug_name' => [ 'name' => 'Verbose Position Name', 'description' => 'About where will be displayed(up to you)', 'mode' => 'iframe', ], ]

If you set mode as ‘iframe’, this position will have URL and display ad in very simple HTML pages. You can get URL from view link in position list of admin screen.

This feature is useful to deliver ad in external platform like Facebook Instant Article.

免费使用Business套餐
通过安装,您同意 WordPress.com 服务条款第三方插件条款
目前已测试版本
WordPress 6.7.4
这个插件是可用的下载,适用于您的站点。