Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brandondove/d560fa7012a535b4f845cb85880a1fb8 to your computer and use it in GitHub Desktop.
Save brandondove/d560fa7012a535b4f845cb85880a1fb8 to your computer and use it in GitHub Desktop.
<?php
/**
* Adds new responsive ad unit sizes to the selectable options when creating an ad
*/
function example_adsanity_ads_posts_sortable_by_clicks( $vars = array() ) {
$vars = array_merge(
$vars,
array(
'meta_key' => sprintf( '_clicks-%s', mktime( 0,0,0, date( 'n' ), date( 'j' ), date( 'Y' ) ) ),
'orderby' => 'meta_value_num'
)
);
return $vars;
}
add_filter( 'adsanity_ads_posts_sortable_by_clicks', 'example_adsanity_ads_posts_sortable_by_clicks' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment