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 ##

Modifie les colonnes listées dans la liste des articles sur l'admin.

[gist]19e7cabd26bfaff63b29f810fb7f2925[/gist]

adsanity_ads_sortable_posts_columns #.

Modifie la liste des colonnes triables dans la liste des articles de l'administration.

[gist]a02c15897cb6fff31dc661da7560068d[/gist]

adsanity_ads_posts_columns_{$column}_value ##.

Permet de définir la valeur qui doit être affichée dans une colonne particulière. La colonne est identifiée par une clé : {$column}

[gist]abe7418a645720bf2225dad9ee63b0b8[/gist]

adsanity_ad_sizes #

Ce filtre vous permet de modifier les tailles d'annonces que vous pouvez choisir lors de la création d'une unité publicitaire.

[gist]c906fc398ae5dc7479c1035a6dbf788c[/gist]

adsanity_ads_posts_sortable_by_{$orderby} #

Permet de définir des paramètres de tri personnalisés

[gist]d560fa7012a535b4f845cb85880a1fb8[/gist]

pj_ads_labels #

Permet de modifier les libellés du type de message personnalisé Annonces.

[gist]26eea2b3dbe4de33aa4b8fa4bfb281de[/gist]

ads_setup

Permet de modifier l'un des arguments passés à la fonction register_post_type

[gist]537464049cd25626fe636bea44ed3d17[/gist]

adsanity_post_class #

Vous pouvez modifier les classes CSS qui entourent une unité publicitaire.

[gist]470fb3a01fa9b74362f8dc78296d904c[/gist]

Actions #

Nous avons intégré quelques actions personnalisées dans AdSanity pour aider les développeurs comme vous à étendre les comportements par défaut. Vous trouverez ci-dessous une liste des actions que nous incluons dans le plugin. Le code personnalisé peut être placé dans le fichier functions.php de votre thème ou dans un plugin personnalisé.

ads_init #

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

La fonction ads_init s'exécute lorsque le type de message publicitaire est configuré. Vous pouvez utiliser ce crochet pour enregistrer des taxonomies supplémentaires, par exemple.

adsanity_before_ad_wrapper #

adsanity_before_ad #

adsanity_after_ad #

adsanity_after_ad_wrapper #

adsanity_before_track_click #

adsanity_before_redirect #

Visibilité de la publicité #

Toutes nos requêtes pour les annonces utilisent WP_Query ou get_posts()afin que vous puissiez utiliser les crochets du noyau de WordPress tels que pre_get_post ainsi que les crochets énumérés ci-dessous.

Random Ad/Ad Group #

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.

Annonce unique

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.

Personnalisation de l'affichage des annonces

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.

Styling Ad Units #

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} (exemple : ad-125x125) – This allows you to style all ads of the same size
  2. column-{column number} (exemple : 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.

Quelques actions et filtres liés à l'affichage sont intégrés à notre système de création de modèles. Ils vous permettent de filtrer les classes CSS et d'ajouter des balises autour de l'unité publicitaire afin de pouvoir la styliser.

Filtres

Actions

Modèles de thèmes

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.

Si vous souhaitez modifier le balisage de toutes les annonces, il vous suffit de copier l'élément suivant ad.php à partir du fichier theme-templates dans votre thème et personnalisez-le.

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.

Enfin, si vous souhaitez modifier le balisage d'une annonce particulière, vous pouvez renommer le fichier en ad-1234.php où 1234 est l'ID de l'annonce que vous souhaitez modifier. Remarque : vous pouvez trouver l'ID en regardant l'ID HTML qui est appliqué à l'annonce dans le balisage.

Filtres

Actions

Visibilité des annonces

Personnalisation de l'affichage des annonces

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.