_x( 'Schemas', 'post type general name', 'jsgen' ), 'singular_name' => _x( 'Schema', 'post type singular name', 'jsgen' ), 'menu_name' => _x( 'Schemas', 'admin menu', 'jsgen' ), 'name_admin_bar' => _x( 'Schema', 'add new on admin bar', 'jsgen' ), 'add_new' => _x( 'Add New', 'schema', 'jsgen' ), 'add_new_item' => __( 'Add New Schema', 'jsgen' ), 'new_item' => __( 'New Schema', 'jsgen' ), 'edit_item' => __( 'Edit Schema', 'jsgen' ), 'view_item' => __( 'View Schema', 'jsgen' ), 'all_items' => __( 'All Schemas', 'jsgen' ), 'search_items' => __( 'Search Schemas', 'jsgen' ), 'parent_item_colon' => __( 'Parent Schemas:', 'jsgen' ), 'not_found' => __( 'No Schemas found.', 'jsgen' ), 'not_found_in_trash' => __( 'No Schemas found in Trash.', 'jsgen' ) ); $args = array( 'labels' => $labels, 'public' => true, 'menu_icon' => 'dashicons-editor-code', 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => null, 'supports' => array( 'title' ) ); register_post_type( 'json_schema', $args ); } /** * Adds a box to the main column on the Post and Page edit screens. */ function jsgen_add_meta_box() { $screens = array('json_schema' ); foreach ( $screens as $screen ) { add_meta_box( 'jsgen_fields', __( 'JSON Schema', 'jsgen' ), 'jsgen_meta_box_callback', $screen ); add_meta_box( 'jsgen_add_to', __( 'Schema Settings', 'jsgen' ), 'jsgen_add_this_callback', $screen, 'side' ); } } add_action( 'add_meta_boxes_json_schema', 'jsgen_add_meta_box' ); function jsgen_add_this_callback( $post ){ // Add a nonce field so we can check for it later. wp_nonce_field( 'jsgen_meta_box', 'jsgen_meta_box_nonce' ); $genAddTo = get_post_meta( $post->ID, 'genAddTo', true ); $gen_page_ids = maybe_unserialize(get_post_meta( $post->ID, 'gen_page_ids', true)); ?>
|
How to Use:#1 - Fill out the fields to the left #2 - Select your Schema Setting on the right #3 - Publish #4 - Validate - Click here and enter page URL Note: Please make sure your theme is using wp_head() function |
|||||||||||||||||||||||||||||||||||
|
<!-- JSON Schema Generator created by www.51blocks.com.-->
<script type="application/ld+json"> { "@context": "https://schema.org", } </script> |