We have built some custom filters into AdSanity to help developers like yourself extend and/or modify the default behaviors. Below is a list of filters that we include in the plugin. Custom code can be placed in your theme’s functions.php file or in a custom plugin.

adsanity_ads_posts_columns_columns #

Modifica as colunas listadas na listagem dos correios na administração.

[gist]19e7cabd26bfaff63b29f810fb7f2925[/gist]

adsanity_ads_sortable_posts_columns_sortable #

Modifica a lista de colunas classificáveis na listagem de correio na administração.

[gist]a02c15897cb6fff31dc661da7560068d[/gist]

adsanity_ads_posts_columns_{$column}_value #

Permite-lhe definir o valor que deve ser exibido numa determinada coluna. A coluna é identificada por uma chave: {$column}

[gist]abe7418a645720bf2225dad9ee63b0b8[/gist]

adsanity_ad_sizes #

Este filtro permite-lhe alterar os tamanhos de anúncios que estão disponíveis para escolher ao criar uma unidade de anúncio.

[gist]c906fc398ae5dc7479c1035a6dbf788c[/gist]

adsanity_ads_posts_sortable_by_{$orderby} #

Permite-lhe definir parâmetros de ordenação personalizados

[gist]d560fa7012a535b4f845cb85880a1fb8[/gist]

pj_ads_labels #

Permite-lhe alterar as etiquetas dos anúncios tipo post personalizados.

[gist]26eea2b3dbe4de33aa4b8fa4bfb281de[/gist]

ads_setup #

Permite-lhe modificar qualquer dos argumentos passados para a função register_post_type

[gist]537464049cd25626fe636bea44ed3d17[/gist]

adsanity_post_class #

Permite-lhe modificar as classes css que envolvem uma unidade de anúncio

[gist]470fb3a01fa9b74362f8dc78296d904c[/gist]

Acções #

Incorporámos algumas acções personalizadas no AdSanity para ajudar os programadores como você a alargar os comportamentos por defeito. Abaixo está uma lista de acções que incluímos no plugin. O código personalizado pode ser colocado no ficheiro functions.php do seu tema ou num plugin personalizado.

ads_init #

[gist]https://gist.github.com/brandondove/586daf3a0691a1ca03a45d8a9687819a[/gist]

a função ads_init funciona quando o tipo de anúncio está a ser criado. Pode utilizar este gancho para registar taxonomias adicionais, por exemplo.

adsanity_before_ad_wrapper #

adsanity_before_ad #

adsanity_after_ad #

adsanity_after_ad_wrapper #

adsanity_before_track_click #

adsanity_before_redirect #

Visibilidade do anúncio #

Todas as nossas consultas para utilização de anúncios WP_Query ou get_posts()por isso pode usar os ganchos do núcleo do WordPress, como pre_get_post bem como os ganchos listados abaixo.

Anúncio Aleatório/Grupo de Anúncio #

apply_filters( 'adsanity_hide_ad_group', $group_ids ); – Needs to return an array. $group_ids is an array of Ad Group IDs that you want included in the ad display. All ads in the included groups will be eligible for display. This is populated from the selections made in a widget, shortcode attributes, block, or template tag.

apply_filters( 'adsanity_hide_ad_in_group', array(), $group_ids ); – Needs to return an array. The array is empty by default, but you can add specific Ad Post IDs to be excluded from display. These ads would be intentionally not included in the display even if they are in the Ad Groups from the above filter.

Anúncio Único #

apply_filters( 'adsanity_hide_ad', false, $post_id ); – Needs to return a boolean. If true, the ad will not display. The boolean is false by default.

Personalização do anúncio #

One of the things we get asked about a lot is how to avoid detection from Ad Blockers. While we’ve explained other options to respect those visitor’s ad display preferences, we understand that there are some instances that you aren’t using AdSanity for typical advertising. Maybe you’re just using AdSanity to track views and clicks on Image based content, for example. We provide you with a couple of methods to modify the display of individual ads, groups of ads, or all ads.

Unidades de Anúncio de Estilos #

Each Ad Unit has a number of CSS Classes and a unique HTML ID that you can target in your theme’s CSS to change its look. The format of these are:

  1. ad-{size} (exemplo: ad-125x125) – This allows you to style all ads of the same size
  2. column-{column number} (exemplo: column-2) – While relevant only to groups of ads, this allows you to style all ads in a particular column
  3. alignleft | aligncenter | alignright | alignnone – These four styles are generally already handled inside of most themes, but if you want to apply additional styles to better handle alignment, this is the place to do so. Note: only one class will be added to each ad unit.

If all of those classes don’t suit your needs or you want to change them, you can attach additional classes to each Ad Unit using a filter as described below.

Existem algumas acções relacionadas com a exibição e filtros incorporados no nosso sistema de modelos. Estes permitem filtrar classes CSS e adicionar marcas em torno da unidade de anúncio, para que se possa estilizá-la.

Filtros

Acções

Tema Modelos #

Sometimes you need to have more control over the markup for your ads. We’ve extended WordPress Core’s template hierarchy to allow you to fully customize an ad’s markup through a theme template.

Se quiser alterar a marcação de todos os anúncios, basta copiar o ad.php ficheiro do theme-templates para o seu tema e personalizá-lo à distância.

If you want to modify the markup for all ads of a particular size, you can rename that file to something like ad-125×125.php, where 125×125 is the size that you’re trying to modify. Note: you can find the size by looking at the classes that are applied to the ad in the markup.

Finalmente, se quiser alterar a marcação de um determinado anúncio, pode renomear o ficheiro para ad-1234.php onde 1234 é o ID do anúncio que pretende modificar. Nota: pode encontrar o ID ao procurar o ID HTML que é aplicado ao anúncio na marcação.

Filtros

Acções

Visibilidade do anúncio

Personalização de anúncios

Didn’t find what you were looking for?

If you’re a subscriber to AdSanity and don’t find an answer to your specific question please submit a request and our support department will address your issue quickly.