array( 'name' => __( 'Adverts' ), 'singular_name' => __( 'Advert' ), 'all_items'=>'All Adverts', 'edit_item'=>'Edit Advert', 'update_item'=>'Update Advert', 'add_new_item'=>'Add New Advert', 'new_item_name'=>'New Advert', ), 'public' => true, 'exclude_from_search' => true, 'menu_position' => 5, 'supports' => array( 'title', 'thumbnail' ) ) ); } add_action( 'init', 'akp_create_post_type' ); function akp_widget_registration() { register_widget( 'AdKingPro_Widget' ); } add_action( 'widgets_init', 'akp_widget_registration'); // Add scripts to page function akp_my_scripts_method() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'adkingpro-js', plugins_url('js/adkingpro-functions.js', dirname(__FILE__)), array('jquery') ); wp_localize_script( 'adkingpro-js', 'AkpAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'ajaxnonce' => wp_create_nonce( 'akpN0nc3' ), ) ); } add_action('wp_enqueue_scripts', 'akp_my_scripts_method'); // Update title field to become URL field function akp_title_text_input( $title ){ global $post; if($post->post_type == 'adverts_posts') return $title = 'Advert URL ie http://durham.net.au/wp-plugins/adkingpro'; return $title; } add_filter( 'enter_title_here', 'akp_title_text_input' ); // Update Feature Image to become Advert Image function akp_change_meta_boxes() { remove_meta_box( 'postimagediv', 'adverts_posts', 'side' ); add_meta_box('postimagediv', __('Advert Image'), 'post_thumbnail_meta_box', 'adverts_posts', 'normal', 'high'); add_meta_box('postremoveurllink', __('Remove Link from Advert?'), 'akp_remove_url_link', 'adverts_posts', 'advanced', 'high'); add_meta_box('postclickstatsdiv', __('Advert Stats'), 'akp_post_click_stats', 'adverts_posts', 'advanced', 'low'); add_meta_box('revenuevaluesdiv', __('Advert Revenue'), 'akp_revenue_values', 'adverts_posts', 'side', 'low'); } add_action('do_meta_boxes', 'akp_change_meta_boxes'); // Output stats for post function akp_post_click_stats($object, $box) { global $wpdb; $clicks = $wpdb->get_results("SELECT COUNT(*) as clicks FROM ".$wpdb->prefix."akp_click_log WHERE post_id = '$object->ID'"); echo "This banner has had ".$clicks[0]->clicks." since being published. View Detailed Report"; } // Add checkbox to remove URL Link off advert function akp_remove_url_link($object, $box) { global $post; $remove_url = get_post_meta( $post->ID, 'akp_remove_url', true ); // Use nonce for verification echo ''; echo ''; } // Add checkbox to remove URL Link off advert function akp_revenue_values($object, $box) { global $post; $revenue_impression = get_post_meta( $post->ID, 'akp_revenue_per_impression', true ); $revenue_click = get_post_meta( $post->ID, 'akp_revenue_per_click', true ); echo '
Shortcodes can be used in any page or post on your site. By default:
[adkingpro]
is defaulting to the advert type 'Sidebar' and randomly chosing from that. You can define your own advert type and display the adverts attached to that type by:
[adkingpro type="your-advert-type-slug"]
Alternatively, you can display a single advert by entering its "Banner ID" which can be found in the table under the Adverts section:
[adkingpro banner="{banner_id}"]
To add this into a template, just use the "do_shortcode" function:
<?= do_shortcode("[adkingpro]"); ?>
Download themes from my plugin page. Locate the themes folder in the adkingpro plugin folder, generally located:
/wp-content/plugins/adkingpro/themes/
Unzip the downloaded zip file and upload the entire folder into the themes folder mentioned above.
Once uploaded, return to this page and your theme will be present in the PDF Theme dropdown to the left. Choose the theme and save the options. Next time you generate a report, the theme you have chosen will be used.
The ability to upload the zip file straight from here will be added soon
Nine times out of ten it will be due to your own scripts being added above the standard area where all the plugins are included. If you move your javascript files below the function, "wp_head()" in the "header.php" file of your theme, it should fix your problem.
Yes. Enter a '#' in as the URL for the banner when setting it up. At output, the banner is given a number of classes to allow for styling, one being "banner{banner_id}", where you would replace the "{banner_id}" for the number in the required adverts class. Use this in a jquery click event and prevent the default action of the click to make it do the action you require:
$(".adkingprobanner.banner{banner_id}").click(
function(e) {
e.preventDefault();
// Your action here
});