post_type == 'adverts_posts') return true; return false; } function register_akp_options() { register_setting( 'akp-options', 'expiry_time' ); register_setting( 'akp-options', 'impression_expiry_time' ); register_setting( 'akp-options', 'week_start' ); register_setting( 'akp-options', 'revenue_currency' ); register_setting( 'akp-options', 'pdf_theme' ); register_setting( 'akp-options', 'akp_image_sizes' ); register_setting( 'akp-options', 'akp_auth_role' ); } add_action( 'admin_init', 'register_akp_options' ); // Default Options add_option( 'expiry_time', '+6 hours' ); add_option( 'impression_expiry_time', '+0 hours' ); add_option( 'week_starts', 'monday' ); add_option( 'revenue_currency', '$' ); add_option( 'pdf_theme', 'default' ); add_option( 'akp_image_sizes', '' ); add_option( 'akp_auth_role', 'subscriber'); // Register Adverts function akp_create_post_type() { $role = get_option('akp_auth_role'); $cap = 'akp_edit_one'; switch ($role) { case 'administrator': $cap = 'akp_edit_five'; break; case 'editor': $cap = 'akp_edit_four'; break; case 'author': $cap = 'akp_edit_three'; break; case 'contributor': $cap = 'akp_edit_two'; break; case 'subscriber': $cap = 'akp_edit_one'; break; } $cap = 'akp_edit_five'; register_post_type( 'adverts_posts', array( 'labels' => 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', ), 'capabilities' => array( 'publish_posts' => $cap, 'edit_posts' => $cap, 'edit_others_posts' => $cap, 'delete_posts' => $cap, 'delete_others_posts' => $cap, 'read_private_posts' => $cap, 'edit_post' => $cap, 'delete_post' => $cap, 'read_post' => $cap, ), 'public' => true, 'exclude_from_search' => true, 'menu_position' => 5, 'supports' => array( 'title', 'thumbnail' ) ) ); register_taxonomy( 'advert_types', 'adverts_posts', array( 'hierarchical' => true, 'labels' => array( 'name'=>'Advert Types', 'singular_name'=>'Advert Type', 'all_items'=>'All Advert Types', 'edit_item'=>'Edit Advert Type', 'update_item'=>'Update Advert Type', 'add_new_item'=>'Add New Advert Type', 'new_item_name'=>'New Advert Type', 'search_items'=>'Search Advert Types', ), 'query_var' => true, 'rewrite' => array('slug' => 'adverts_slug') ) ); } add_action( 'init', 'akp_create_post_type' ); // Styling for the custom post type icon function wpt_akp_icons() { ?> admin_url( 'admin-ajax.php' ), 'ajaxnonce' => wp_create_nonce( 'akpN0nc3' ), ) ); } add_action('wp_enqueue_scripts', 'akp_my_scripts_method'); //add extra fields to category edit form callback function function akp_extra_advert_types_fields( $tag ) { //check for existing featured ID $t_id = $tag->term_id; $cat_meta = get_option( "akp_advert_type_$t_id"); ?>
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}']
Have a select few adverts that you'd like to show? No problem, just specify the ids separated by commas:
[adkingpro banner='{banner_id1}, {banner_id2}']
Want to output a few adverts at once? Use the 'render' option in the shortcode:
[adkingpro banner='{banner_id1}, {banner_id2}' render='2']
[adkingpro type='your-advert-type-slug' render='2']
Only have a small space and what a few adverts to display? Turn on the auto rotating slideshow!:
[adkingpro type="your-advert-type-slug" rotate='true']
There are also some settings you can play with to get it just right:
Use one or all of these settings:
[adkingpro rotate='true' effect='fade' speed='5000' changespeed='600']
To add this into a template, just use the "do_shortcode" function:
<?php
if (function_exists('adkingpro_func'))
echo do_shortcode("[adkingpro type='sidebar']");
?>
Download themes from the King Pro Plugins 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
});
The plugin needs your permission to save the PDFs you generate to the output folder in the plugins folder. To do this, you are required to update the outputs permissions to be writable. Please see the wordpress help page to carry this out.