[wordpress插件] Ad Code Manager广告代码管理器

wordpress 插件 文章 2020-01-28 19:40 647 0 全屏看文

AI助手支持GPT4.0

评分

0

0

描述

Ad Code Manager gives non-developers an interface in the WordPress admin for configuring your complex set of ad codes.

广告代码管理器为非开发人员提供了WordPress管理员界面,用于配置复杂的广告代码集。

Some code-level configuration may be necessary to setup Ad Code Manager.

设置广告代码管理器可能需要一些代码级配置。

Ad tags must be added (via do_action()) to your theme’s template files where you’d like ads to appear.

必须将广告代码(通过 do_action())添加到您想要展示广告的主题模板文件中。

Alternatively, you can incorporate ad tags into your website with our widget and our shortcode.

另外,您可以使用我们的小部件和简码将广告代码合并到您的网站中。

Check out the configuration

查看配置

guide for the full details.

指南以获取详细信息。

A common set of parameters must also be defined for your ad provider.

还必须为广告提供商定义一组通用的参数。

This includes the tag IDs used by your template, the default URL for your ad provider, and the default HTML surrounding that URL.

这包括模板使用的标记ID,广告提供商的默认URL以及该URL周围的默认HTML。

Ad Code Manager comes with support for Google Doubleclick For Publishers (and Async), and Google AdSense.

广告代码管理器随附了对Google Doubleclick For Publishers(和Async)以及Google AdSense的支持。

All of the logic is abstracted, however, so configuring a different provider is relatively easy.

但是,所有逻辑都是抽象的,因此配置其他提供程序相对容易。

Check providers/doubleclick-for-publishers.php for an idea of how to extend ACM to suit your needs.

providers / doubleclick-for-publishers.php 中找到有关如何扩展ACM以适应您的需求的想法。

Once this configuration is in place, the Ad Code Manager admin interface will allow you to add new ad codes, modify the parameters for your script URL, and define conditionals to determine when the ad code appears.

完成此配置后,广告代码管理器管理界面将允许您添加新的广告代码,修改脚本URL的参数以及定义条件来确定广告代码何时显示。

Conditionals are core WordPress functions like is_page(), is_category(), or your own custom functions that evaluate certain expression and then return true or false.

条件语句是WordPress的核心功能,例如is_page(),is_category()或您自己的自定义函数,这些函数对某些表达式求值,然后返回true或false。

Fork the plugin on Github and 在Github上分叉插件

.wordpress.com/" rel="nofollow">follow our development blog.

.wordpress.com /“ rel =” nofollow“>关注我们的开发博客。

Configuration Filters

配置过滤器

There are some filters which allow you to easily customize the output of the plugin.

有些过滤器可让您轻松自定义插件的输出。

You should place these filters in your theme’s functions.php file or in another appropriate place.

您应该将这些过滤器放置在主题的functions.php文件中或其他合适的位置。

Check out this gist to see all of the filters in action.

查看要点,以查看所有正在使用的过滤器。

acm_ad_tag_ids

acm_ad_tag_ids

Ad tag ids are used as a parameter when adding tags to your theme (e.g. do_action( ‘acm_tag’, ‘my_top_leaderboard’ )).

在向主题添加标签时(例如do_action('acm_tag','my_top_leaderboard')),广告标签ID用作参数。

The url_vars defined as part of each tag here will also be used to replace tokens in your default URL.

在此处定义为每个标记一部分的 url_vars 也将用于替换默认URL中的标记。

Arguments:

参数:

* array $tag_ids array of default tag ids

*数组$ tag_ids个默认标签ID的数组

Example usage: Add a new ad tag called ‘my_top_leaderboard’

用法示例:添加一个名为“ my_top_leaderboard”的新广告代码

    add_filter( 'acm_ad_tag_ids', 'my_acm_ad_tag_ids' );        

  add_filter('acm_ad_tag_ids','my_acm_ad_tag_ids');        

function my_acm_ad_tag_ids( $tag_ids ) {            

函数my_acm_ad_tag_ids($ tag_ids){            

$tag_ids[] = array(                

$ tag_ids [] = array(                

'tag' => 'my_top_leaderboard', // tag_id                

'tag'=>'my_top_leaderboard',// tag_id                

'url_vars' => array(                    

'url_vars'=>数组(                    

'sz' => '728x90', // %sz% token                    

'sz'=>'728x90',//%sz%令牌                    

'fold' => 'atf', // %fold% token                    

'fold'=>'atf',//%fold%令牌                    

'my_custom_token' => 'something' // %my_custom_token% will be replaced with 'something'                

'my_custom_token'=>'something'//%my_custom_token%将被替换为'something'                

),            

),            

);            

);            

return $tag_ids;        

返回$ tag_ids;        

}

}

acm_default_url

acm_default_url

Set the default tokenized URL used when displaying your ad tags.

设置显示广告代码时使用的默认标记化URL。

This filter is required.

此过滤器是必需的。

Arguments:

参数:

* string $url The tokenized url of Ad Code

* string $ url广告代码的标记化网址

Example usage: Set your default ad code URL

用法示例:设置默认广告代码网址

    add_filter( 'acm_default_url', 'my_acm_default_url' );        

  add_filter('acm_default_url','my_acm_default_url');        

function my_acm_default_url( $url ) {            

函数my_acm_default_url($ url){            

if ( 0 === strlen( $url ) ) {                

如果(0 === strlen($ url)){                

return "http://ad.doubleclick.net/adj/%site_name%/%zone1%;s1=%zone1%;s2=;pid=%permalink%;fold=%fold%;kw=;test=%test

返回“ http://ad.doubleclick.net/adj/%site_name%/%zone1%;s1=%zone1%;s2=;pid=%永久链接%; fold =%fold%; kw =; test =%test

%;ltv=ad;pos=%pos%;dcopt=%dcopt%;tile=%tile%;sz=%sz%;";            

%; ltv = ad; pos =%pos%; dcopt =%dcopt%; tile =%tile%; sz =%sz%;“;            

}        

}        

}

}

acm_output_html

acm_output_html

The HTML outputted by the do_action( 'acm_tag', 'ad_tag_id' ); call in your theme.

在主题中调用 do_action('acm_tag','ad_tag_id'); 输出的HTML。

Support multiple ad formats ( e.g. Javascript ad tags, or simple HTML tags ) by adjusting the HTML rendered for a given ad tag.

通过调整为给定广告代码呈现的HTML,支持多种广告格式(例如Javascript广告代码或简单的HTML代码)。

The %url% token used in this HTML will be filled in with the URL defined with acm_default_url.

此HTML中使用的%url%令牌将使用 acm_default_url 定义的URL进行填充。

Arguments:

参数:

* string $output_html The original output HTML

*字符串$ output_html原始输出HTML

* string $tag_id Ad tag currently being accessed

*字符串$ tag_id当前正在访问的广告代码

Example usage:

用法示例:

    add_filter( 'acm_output_html', 'my_acm_output_html', 10, 2 );        

  add_filter('acm_output_html','my_acm_output_html',10,2);        

function my_acm_output_html( $output_html, $tag_id ) {            

函数my_acm_output_html($ output_html,$ tag_id){            

switch ( $tag_id ) {                

开关($ tag_id){                

case 'my_leaderboard':                    

案例“ my_leaderboard”:                    

$output_html = '';                    

$ output_html =' ';                    

break;                

打破;                

case 'rich_media_leaderboard':                    

案例“ rich_media_leaderboard”:                    

$output_html = '';                    

$ output_html ='

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] Bootstrap modal popup引导模式弹出
[wordpress插件] BP TrailingslashitBP Trailingslashit
[wordpress插件] acf-autosizeacf-autosize
[wordpress插件] Consume This消费这个
[wordpress插件] Custom Setting自定义设置
随便看看
怎么添加小程序支付功能? 3517
教育科技公司申请微信支付被拒绝? 3851
微信公众号免300认证教程 4947
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 4065
小程序广告组件通过审核,但是小程序内没有显示广告? 4145
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8010
问题? 7242
如何快速搭建抽奖助手小程序(无需代码知识) 5029
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 5981
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5504