コード例 #1
0
ファイル: plugin.php プロジェクト: abenamer/thereveal
$dfp_post_type = new DFP_Ads_Post_Type();
add_action('init', array($dfp_post_type, 'create_post_type'), 0, 0);
add_action('add_meta_boxes', array($dfp_post_type, 'add_meta_boxes'), 10, 2);
add_action("save_post_{$dfp_post_type->name}", array($dfp_post_type, 'save_meta_box'), 10, 2);
add_action('dfp_ads_fields', array($dfp_post_type, 'add_inputs'));
/* Custom Columns */
add_filter("manage_{$dfp_post_type->name}_posts_columns", array($dfp_post_type, 'add_shortcode_column'));
add_action("manage_{$dfp_post_type->name}_posts_custom_column", array($dfp_post_type, 'shortcode_column_value'), 10, 1);
// Ads Shortcode Reference
add_action('dfp_ads_metabox_top', array($dfp_post_type, 'ad_position_shortcode'));
// Creates the settings table
add_action('dfp_ads_metabox_middle', array($dfp_post_type, 'settings_table'), 9);
/* Begin creating the new ads objects */
$dfp_ads = new DFP_Ads();
$dfp_ads->dir_uri = plugins_url(null, __FILE__);
$dfp_ads->set_account_id(dfp_get_settings_value('dfp_property_code'));
// = '/35190362/';
/*
 * Enqueues the styles and scripts into WordPress. When this action runs
 * it also will grab all of the positions and other filtered in information
 */
add_action('wp_enqueue_scripts', array($dfp_ads, 'scripts_and_styles'));
/* Sets Menu Position. Default 20 */
add_filter('dfp_ads_menu_position', function ($pos) {
    return 79;
}, 10);
/*
 * Adds input fields to the DFP_Ads post type.
 *
 * Any number can be added at any time, they must have the array keys listed
 * below.
コード例 #2
0
ファイル: plugin.php プロジェクト: pdemaria/dfp-ads
add_action('init', array($dfp_post_type, 'create_post_type'), 0, 0);
add_action('add_meta_boxes', array($dfp_post_type, 'add_meta_boxes'), 10, 2);
add_action("save_post_{$dfp_post_type->name}", array($dfp_post_type, 'save_meta_box'), 10, 2);
add_action('dfp_ads_fields', array($dfp_post_type, 'add_inputs'));
/* Custom Columns */
add_filter("manage_{$dfp_post_type->name}_posts_columns", array($dfp_post_type, 'add_shortcode_column'));
add_action("manage_{$dfp_post_type->name}_posts_custom_column", array($dfp_post_type, 'shortcode_column_value'), 10, 1);
// Ads Shortcode Reference
add_action('dfp_ads_metabox_top', array($dfp_post_type, 'ad_position_shortcode'));
// Creates the settings table
add_action('dfp_ads_metabox_middle', array($dfp_post_type, 'settings_table'), 9);
/* Begin creating the new ads objects */
$dfp_ads = new DFP_Ads();
$dfp_ads->dir_uri = plugins_url(null, __FILE__);
$dfp_ads->set_account_id(dfp_get_settings_value('dfp_property_code'));
$dfp_ads->set_asynchronous_loading(dfp_get_settings_value('dfp_synchronous_tags'));
/*
 * Enqueues the styles and scripts into WordPress. When this action runs
 * it also will grab all of the positions and other filtered in information
 */
add_action('wp_enqueue_scripts', array($dfp_ads, 'scripts_and_styles'), 100);
/* Sets Menu Position. Default 20 */
add_filter('dfp_ads_menu_position', function ($pos) {
    return 79;
}, 10);
/*
 * Adds input fields to the DFP_Ads post type.
 *
 * Any number can be added at any time, they must have the array keys listed
 * below.
 *