"; register_post_type( 'apb', [ 'labels' => [ 'name' => __( 'Advanced Posts', 'advanced-post-block'), 'singular_name' => __( 'Advanced Posts', 'advanced-post-block' ), 'add_new' => __( 'Add New', 'advanced-post-block' ), 'add_new_item' => __( 'Add New', 'advanced-post-block' ), 'edit_item' => __( 'Edit', 'advanced-post-block' ), 'new_item' => __( 'New', 'advanced-post-block' ), 'view_item' => __( 'View', 'advanced-post-block' ), 'search_items' => __( 'Search', 'advanced-post-block'), 'not_found' => __( 'Sorry, we couldn\'t find the that you are looking for.', 'advanced-post-block' ) ], 'public' => false, 'show_ui' => true, 'show_in_rest' => true, 'publicly_queryable' => false, 'exclude_from_search' => true, 'menu_position' => 14, 'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode( $menuIcon ), 'has_archive' => false, 'hierarchical' => false, 'capability_type' => 'page', 'rewrite' => [ 'slug' => 'apb' ], 'supports' => [ 'title', 'editor' ], 'template' => [ ['ap-block/posts'] ], 'template_lock' => 'all', ]); // Register Post Type } function onAddShortcode( $atts ) { $post_id = $atts['id']; $post = get_post( $post_id ); $blocks = parse_blocks( $post->post_content ); ob_start(); echo render_block( $blocks[0] ); return ob_get_clean(); } function manageAPBPostsColumns( $defaults ) { unset( $defaults['date'] ); $defaults['shortcode'] = 'ShortCode'; $defaults['date'] = 'Date'; return $defaults; } function manageAPBPostsCustomColumns( $column_name, $post_ID ) { if ( $column_name == 'shortcode' ) { echo '
' . esc_html__( 'Copy To Clipboard' ) . '
'; } } function useBlockEditorForPost($use, $post){ if ( $this->post_type === $post->post_type ) { return true; } return $use; } function orderSubMenu( $menu_ord ){ global $submenu; $sMenu = $submenu['edit.php?post_type=apb']; $arr = []; if( apbIsPremium() ){ if( isset( $sMenu[5] ) ){ $arr[] = $sMenu[5]; // Advanced Posts } if( isset( $sMenu[10] ) ){ $arr[] = $sMenu[10]; // Add New } } if( isset( $sMenu[11] ) ){ $arr[] = $sMenu[11]; // Help } if( ( !apbIsPremium() || APB_HAS_PRO ) && isset( $sMenu[12] ) ){ $arr[] = $sMenu[12]; // Upgrade || Pricing || Account } $submenu['edit.php?post_type=apb'] = $arr; return $menu_ord; } } new APBCustomPost();