base = DFlip::get_instance(); $labels = array( 'name' => __( 'DearFlip Book', '3d-flipbook-dflip-lite' ), 'singular_name' => __( 'DearFlip Book', '3d-flipbook-dflip-lite' ), 'menu_name' => __( 'DearFlip Books', '3d-flipbook-dflip-lite' ), 'name_admin_bar' => __( 'DearFlip Book', '3d-flipbook-dflip-lite' ), 'add_new' => __( 'Add New Book', '3d-flipbook-dflip-lite' ), 'add_new_item' => __( 'Add New Book', '3d-flipbook-dflip-lite' ), 'new_item' => __( 'New DearFlip Book', '3d-flipbook-dflip-lite' ), 'edit_item' => __( 'Edit DearFlip Book', '3d-flipbook-dflip-lite' ), 'view_item' => __( 'View DearFlip Book', '3d-flipbook-dflip-lite' ), 'all_items' => __( 'All Books', '3d-flipbook-dflip-lite' ), 'search_items' => __( 'Search DearFlip Books', '3d-flipbook-dflip-lite' ), 'parent_item_colon' => __( 'Parent DearFlip Books:', '3d-flipbook-dflip-lite' ), 'not_found' => __( 'No DearFlip-Books found.', '3d-flipbook-dflip-lite' ), 'not_found_in_trash' => __( 'No DearFlip Books found in Trash.', '3d-flipbook-dflip-lite' ) ); $args = array( 'labels' => $labels, 'description' => __( 'Description.', '3d-flipbook-dflip-lite' ), 'public' => false, //this removes the permalink option 'publicly_queryable' => false, 'exclude_from_search' => true, // if not excluded, posts will be displayed in normal search. This will hide it from other archive and taxonomy listing, and needs to be fetched manually. 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => false, //array('slug' => $this->base->slug), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => null, 'menu_icon' => 'dashicons-book', 'supports' => array( 'title', 'editor', 'revisions' ) ); register_post_type( 'dflip', $args ); register_taxonomy( 'dflip_category', 'dflip', array( 'hierarchical' => true, 'public' => false, 'publicly_queryable' => false, 'show_ui' => true, //display the category admin page 'show_admin_column' => true, 'show_in_nav_menus' => true, 'rewrite' => array( 'slug' => 'book-category' ), ) ); if ( is_admin() ){ add_action( 'wp_ajax_hidedflipRating', array( $this, 'hidedflipRating' )); if(!( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { $this->init_admin(); } } else {// Load frontend only components. $this->init_front(); } } /** * Loads all admin related files into scope. * * @since 1.0.0 */ public function init_admin() { // Remove quick editing from the dFlip post type row actions. add_filter( 'post_row_actions', array( $this, 'remove_quick_edit' ), 10, 1 ); // Manage post type columns. add_filter( 'manage_dflip_posts_columns', array( $this, 'dflip_columns' ) ); add_action( 'manage_dflip_posts_custom_column', array( $this, 'dflip_columns_content' ), 10, 2 ); add_filter( 'manage_edit-dflip_category_columns', array( $this, 'dflip_cat_columns' ) ); add_filter( 'manage_dflip_category_custom_column', array( $this, 'dflip_cat_columns_content' ), 10, 3 ); add_action( 'restrict_manage_posts', array( $this, 'dflip_category_filter' ), 10, 2 ); add_action( 'admin_notices', array( $this, 'display_review_help' ) ); } public function init_front() { add_filter( 'the_content', array( $this, 'filter_the_pdf_attachment_content' ) ); } public function hidedflipRating() { check_ajax_referer( 'dflip_hide_rating' ); if ( ! current_user_can( 'edit_posts' ) ) { wp_send_json_error(); } update_option( 'dflip_showratingdiv', 'no' ); wp_send_json_success(); exit; } public function display_review_help() { global $wp_query; if ( isset( get_current_screen()->id ) && 'edit-dflip' == get_current_screen()->id ) { if ( $wp_query->post_count > 2 ) { $post = $wp_query->posts[ $wp_query->post_count - 1 ]; $datetime1 = new DateTime( $post->post_date ); $datetime2 = new DateTime(); // current date $interval = $datetime1->diff( $datetime2 ); if ( $interval->days > 7 && get_option( 'dflip_showratingdiv' ) != "no" ) { echo '
Awesome, thank you for using DearFlip Plugin for more than 1 week.
May we ask you to give it a 5-star rating on Wordpress?
This will help to spread its popularity and to make this plugin a better one.
Your help is much appreciated. Thank you very much,
~DearHive Team