post_type = $custom_post_type; add_filter( 'enter_title_here', array( $this, 'wpaf_change_enter_title' ) ); } /** * This function will generate post type labels. * * @param $name_singular * @param $name_plural * @param $t_domain * * @return array * @since 1.0 */ public static function post_type_labels( $name_singular, $name_plural, $t_domain, $plugin_name ) { /** * These are the labels for custom post type. * When we register the custom post type we * will use these. * * @since 1.0 */ $labels = array( 'name' => esc_html( $name_plural ), 'singular_name' => esc_html( $name_singular ), 'menu_name' => esc_html( $plugin_name ), 'name_admin_bar' => esc_html( $name_plural ), 'all_items' => esc_html__( 'All ', 'affcoupon' ) . esc_html( $name_plural ), 'add_new' => esc_html__( 'Add New ', 'affcoupon' ) . esc_html( $name_singular ), 'add_new_item' => esc_html__( 'Add New ', 'affcoupon' ) . esc_html( $name_singular ), 'edit_item' => esc_html__( 'Edit ', 'affcoupon' ) . esc_html( $name_singular ), 'new_item' => esc_html__( 'New ', 'affcoupon' ) . esc_html( $name_singular ), 'view_item' => esc_html__( 'View ', 'affcoupon' ) . esc_html( $name_singular ), 'search_items' => esc_html__( 'Search ', 'affcoupon' ) . esc_html( $name_plural ), 'not_found' => esc_html__( 'No ', 'affcoupon' ) . esc_html( $name_plural ) . esc_html__( ' found', 'affcoupon' ), 'not_found_in_trash' => esc_html__( 'No ', 'affcoupon' ) . esc_html( $name_plural ) . esc_html__( ' found in Trash', 'affcoupon' ), ); return $labels; } /** * This function holds the argument and * registers the custom post type with WordPress * * @param $post_type * @param $name_singular * @param $labels * @param $t_domain * * @since 1.0 */ public static function post_type_register( $post_type, $name_singular, $labels, $t_domain ) { /** * Arguments for the custom post type. * These will be used when we register the * custom post type with WordPress. * * @since 1.0 */ $args = array( 'labels' => $labels, 'description' => esc_html( $name_singular ) . esc_html__( ' Custom Post Type', 'affcoupon' ), 'supports' => array( 'title', 'thumbnail' ), 'public' => false, 'publicly_queriable' => true, 'show_ui' => true, 'menu_position' => 55, 'menu_icon' => WPAF_Plugin::instance()->plugin_assets . 'img/affcoupon_ic.png', 'has_archive' => true, 'show_in_menu' => true, 'capability_type' => 'post', 'show_in_nav_menus' => false, ); /** * WordPress function to register the custom * post type using our post type name and arguments. * * @since 1.0 */ register_post_type( $post_type, $args ); } /** * Changes the 'Enter title here' text. * * @param $input * * @since 1.0 */ function wpaf_change_enter_title( $input ) { if ( is_admin() && 'wpaf_coupons' === get_post_type() ) { return __( 'Enter Coupon Title Here', 'affcoupon' ); } return $input; } }