Skip to content

Commit

Permalink
Deduped tags and categories for use as targeting keywords.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Harvey committed Jul 22, 2013
1 parent 835e546 commit afabde0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions providers/doubleclick-for-publishers-async.php
Expand Up @@ -168,11 +168,11 @@ public function filter_output_html( $output_html, $tag_id ) {
global $wp_query;
$post_id = $wp_query->post->ID;
$args = array( 'fields' => 'names' );
$post_tags = wp_get_post_tags( $post_id, $args );
$post_tags = implode( "','", $post_tags );
$post_categories = wp_get_post_categories( $post_id, $args );
$post_categories = implode( "','", $post_categories );
$keyword_targeting = ".setTargeting('kw',['$post_tags','$post_categories'])";
$post_tags = wp_get_post_tags( $post_id, $args ); // get tag names
$post_categories = wp_get_post_categories( $post_id, $args ); // get category names
$post_keywords_arr = array_unique( array_merge( $post_tags, $post_categories ) ); // remove dupes and merge
$post_keywords = implode( "','", $post_keywords_arr ); // make keyword list for JS
$keyword_targeting = ".setTargeting('kw',['$post_keywords'])";
}
/**
* Get extra parameters for targeting through DFP
Expand Down

0 comments on commit afabde0

Please sign in to comment.