[WordPress] 外掛分享: Taro Ad Fields

首頁外掛目錄 › Taro Ad Fields
WordPress 外掛 Taro Ad Fields 的封面圖片
10+
安裝啟用
尚無評分
330 天前
最後更新
問題解決
WordPress 5.9+ PHP 7.4+ v1.3.5 上架:2017-07-30

內容簡介

您可以為 WordPress 主題建立廣告位置。
在每個位置上,將顯示最新的廣告欄位。
您可以管理廣告的時間表和顯示!

從主題中

在您的主題中調用動作鉤:

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

在這個位置上,最新的廣告將被顯示。
使用Taro Clockwork Post外掛,您可以讓廣告自動過期。

鉤子引數

do_action( $hook_name, $slug, $before, $after );

$hook_name:動作鉤名稱。應為taro_ad_field。
$slug:位置的別名。
$before:廣告塊之前要輸出的字符串。如果沒有廣告,則不會顯示。
$after:廣告塊之後要輸出的字符串。

從小工具中

我們還有為廣告欄位提供的小工具。小工具中將顯示指定位置的最新廣告。

設置默認位置

在您的主題中,添加 taf_default_positions 過濾器鉤子。
這些術語將被自動創建。

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',
],
];
} );

默認為空數組,因此沒有默認位置。
您可以像上面的過濾器鉤子一樣向其中添加新位置。
數組的結構將如下:

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

如果將模式設置為 ‘iframe’,則此位置將具有 URL,並在非常簡單的 HTML 頁面中顯示廣告。
您可以從管理屏幕的位置列表中的查看鏈接中獲取 URL。

此功能非常有用,可在其他平臺上交付廣告,例如Facebook Instant Article。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.3.5) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「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:

', '

', 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 );>

$hook_name: The action hook name. Always should be taro_ad_field.
$slug: Slug of position.
$before: String to be output just before ad block. If no ad exists, this won’t be displayed.
$after: String to be output just after ad block.
$number: Number of ad to be displayed. Default is 1.
$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.

延伸相關外掛

文章
Filter
Mastodon