Skip to content

Instantly share code, notes, and snippets.

@renventura
Created September 25, 2019 02:26
Show Gist options
  • Select an option

  • Save renventura/389d22f856cd65a719dc24d01fa21870 to your computer and use it in GitHub Desktop.

Select an option

Save renventura/389d22f856cd65a719dc24d01fa21870 to your computer and use it in GitHub Desktop.
Snippets for the Gravity Forms purchase form tutorial on wpformsync.com
<?php
add_action( 'init', 'formsync_register_ebooks_cpt' );
/**
* Registers an "E-Books" custom post type
*/
function formsync_register_ebooks_cpt() {
$labels = array(
'name' => 'eBooks',
'singular_name' => 'eBook',
'menu_name' => 'eBooks',
'name_admin_bar' => 'eBook',
'archives' => 'Item Archives',
'attributes' => 'Item Attributes',
'parent_item_colon' => 'Parent Item:',
'all_items' => 'All eBooks',
'add_new_item' => 'Add New eBook',
'add_new' => 'Add New',
'new_item' => 'New eBook',
'edit_item' => 'Edit eBook',
'update_item' => 'Update eBook',
'view_item' => 'View eBook',
'view_items' => 'View eBook',
'search_items' => 'Search eBook',
'not_found' => 'Not found',
'not_found_in_trash' => 'Not found in Trash',
'featured_image' => 'eBook Image',
'set_featured_image' => 'Set eBook image',
'remove_featured_image' => 'Remove eBook image',
'use_featured_image' => 'Use as eBook image',
'insert_into_item' => 'Insert into item',
'uploaded_to_this_item' => 'Uploaded to this item',
'items_list' => 'eBook list',
'items_list_navigation' => 'eBook list navigation',
'filter_items_list' => 'Filter eBook list',
);
$args = array(
'label' => 'eBook',
'description' => 'eBooks',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 25,
'menu_icon' => 'dashicons-book-alt',
'show_in_admin_bar' => true,
'show_in_nav_menus' => false,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => true,
'capability_type' => 'page',
'show_in_rest' => true
);
register_post_type( 'ebook', $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment