_x( 'Adz.world', 'Post Type General Name', 'text_domain' ), 'singular_name' => _x( 'Adz.world', 'Post Type Singular Name', 'text_domain' ), 'menu_name' => __( 'Adz.world', 'text_domain' ), 'name_admin_bar' => __( 'Adz.world', 'text_domain' ), 'archives' => __( 'Adz.world Archives', 'text_domain' ), 'attributes' => __( 'TV Station Ad Attributes', 'text_domain' ), 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ), 'all_items' => __( 'All Adz', 'text_domain' ), 'add_new_item' => __( 'Add New Ad', 'text_domain' ), 'add_new' => __( 'Add New Adz', 'text_domain' ), 'new_item' => __( 'New Ad', 'text_domain' ), 'edit_item' => __( 'Edit Ad', 'text_domain' ), 'update_item' => __( 'Update Ad', 'text_domain' ), 'view_item' => __( 'View Ad', 'text_domain' ), 'view_items' => __( 'View Ad', 'text_domain' ), 'search_items' => __( 'Search Adz.world', 'text_domain' ), 'not_found' => __( 'Not found', 'text_domain' ), 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ), 'featured_image' => __( 'Featured Image', 'text_domain' ), 'set_featured_image' => __( 'Set featured image', 'text_domain' ), 'remove_featured_image' => __( 'Remove featured image', 'text_domain' ), 'use_featured_image' => __( 'Use as featured image', 'text_domain' ), 'insert_into_item' => __( 'Insert into item', 'text_domain' ), 'uploaded_to_this_item' => __( 'Uploaded to this Ad', 'text_domain' ), 'items_list' => __( 'Adz.world list', 'text_domain' ), 'items_list_navigation' => __( 'Adz.world list navigation', 'text_domain' ), 'filter_items_list' => __( 'Filter ads list', 'text_domain' ), ); $args = array( 'label' => __( 'Adz.world', 'text_domain' ), 'description' => __( 'Adz.world to serve up to network', 'text_domain' ), 'labels' => $labels, 'supports' => array('title', 'excrpt', 'editor', 'custom-fields', ), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => false, 'exclude_from_search' => true, 'publicly_queryable' => true, 'capability_type' => 'post', 'show_in_rest' => false, 'menu_icon' => 'dashicons-welcome-view-site', ); register_post_type( 'adz_ad', $args ); } add_action( 'init', 'adz_ad_post_type_pub', 0 ); function ad_network_meta_box_markup_pub($post){ wp_nonce_field(basename(__FILE__), "meta-box-nonce"); $affiliation_network_name = get_post_meta( $post->ID, 'affiliation_network_name', true ); $affiliation_network_url = get_post_meta( $post->ID, 'affiliation_network_url', true ); $affiliation_id = get_post_meta( $post->ID, 'affiliation_id', true ); ?>
$value) { if($key == 'date') { // when we find the date column $new['network_ad_id'] = $network_ad_id; // put the tags column before it } $new[$key] = $value; } return $new; }else{ return $defaults; } } add_filter('manage_posts_columns', 'adz_ad_columns_head'); // Register Custom Taxonomy function ad_taxonomy_pub() { $labels = array( 'name' => _x( 'Ad Types', 'Taxonomy General Name', 'text_domain' ), 'singular_name' => _x( 'Ad Type', 'Taxonomy Singular Name', 'text_domain' ), 'menu_name' => __( 'Ad Types', 'text_domain' ), 'all_items' => __( 'All Ad Types', 'text_domain' ), 'parent_item' => __( 'Parent Item', 'text_domain' ), 'parent_item_colon' => __( 'Parent Item:', 'text_domain' ), 'new_item_name' => __( 'New Ad Type', 'text_domain' ), 'add_new_item' => __( 'Add New Ad Type', 'text_domain' ), 'edit_item' => __( 'Edit Ad Type', 'text_domain' ), 'update_item' => __( 'Update Ad Type', 'text_domain' ), 'view_item' => __( 'View Ad Type', 'text_domain' ), 'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ), 'add_or_remove_items' => __( 'Add or remove items', 'text_domain' ), 'choose_from_most_used' => __( 'Choose from the most used', 'text_domain' ), 'popular_items' => __( 'Popular Ad Types', 'text_domain' ), 'search_items' => __( 'Search Ad Types', 'text_domain' ), 'not_found' => __( 'Not Found', 'text_domain' ), 'no_terms' => __( 'No Ad Types', 'text_domain' ), 'items_list' => __( 'Ad Type List', 'text_domain' ), 'items_list_navigation' => __( 'Ad Type list navigation', 'text_domain' ), ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'public' => true, 'show_ui' => false, 'show_admin_column' => true, 'show_in_nav_menus' => false, 'show_tagcloud' => false, 'rewrite' => false, 'show_in_rest' => false ); register_taxonomy( 'ad_taxonomy', array( 'adz_ad' ), $args ); } add_action( 'init', 'ad_taxonomy_pub', 0 ); /* Sync with Server */ function adz_sync_network_ads($post_id, $post_after, $post_before) { if ($post_after->post_type == 'adz_ad') { adz_NetworkAuthorization::update_ad($post_id, $post_after); } } add_action( 'post_updated', 'adz_sync_network_ads', 10, 3 ); function adz_sync_network_ads_delete( $post_id ){ // We check if the global post type isn't ours and just return global $post_type; if ( $post_type != 'adz_ad' ) { return; } adz_NetworkAuthorization::delete_ad($post_id); // My custom stuff for deleting my custom post type here } add_action( 'before_delete_post', 'adz_sync_network_ads_delete' ); function adz_ifram_button(){ echo 'Adz.world iFrame'; } add_action('media_buttons', 'adz_ifram_button', 11); function adz_button_js(){ echo ''; } add_action('admin_print_footer_scripts', 'adz_button_js', 199); // function to add new submenu for Adz template setting. function adz_templates_setting_menu() { add_submenu_page('edit.php?post_type=adz_ad', 'Adz Template Settings', 'Adz Template Settings', 'manage_options', 'adz-template-setting', 'adz_template_setting'); } add_action('admin_menu', 'adz_templates_setting_menu', 11 ); // Function to add Adz template setting form in backend. function adz_template_setting(){ screen_icon(); if( isset($_POST['adz_template']) && $_POST['adz_template'] != '' ){ $template_settings = array('header_text' => $_POST["header_text"], 'header_style' => $_POST["header_style"], 'footer_text' => $_POST["footer_text"], 'footer_style' => $_POST["footer_style"] ); update_option("template_".$_POST['adz_template'],serialize($template_settings),true); } echo '
'; echo '

Edit your Adz template header and footer text here.

'; echo '
'; echo " "; echo '

'; echo ''; echo '

'; echo ' Right Left Center'; echo '

'; echo ''; echo '

'; echo ' Right Left Center'; submit_button(); echo '
'; } function get_template_settings(){ if(isset($_POST['selected_template'])){ $template_name = $_POST['selected_template']; $template_data = get_option('template_'.$template_name); echo json_encode( unserialize($template_data) ); exit; } } add_action('wp_ajax_get_template_settings', 'get_template_settings'); add_action('wp_ajax_nopriv_get_template_settings', 'get_template_settings');