Skip to content

bigbabert/json-api-cpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

=== JSON API CPT ===

Donate link:

Tags: json api, RESTful cpt, cpt json

Contributors: Alberto Cocchiara

Stable tag: 1.0

Requires at least: 3.0.1

Tested up to: 4.4.2

License: GPLv2 or later

License URI: http://www.gnu.org/licenses/gpl-2.0.html

Extends the JSON API for RESTful CPT get

==Description==

This plugin is an Extension of JSON API plugin and extend the functionality to allow any user to get, edit, add, update and delete any kind of post type.

Features include:

  • CPT get by post type name
  • CPT get by post type name and status

The plugin was created to make available cpt Easy with any mobile or web app external to the loved WordPress CMS.

Hope this will help some.

For details, please check this: http://www.altertech.it/solutions/json-api-cpt/

==Installation==

First you have to install the JSON API Plugin (http://wordpress.org/extend/plugins/json-api/installation/).

In order to use JSON API - CPT you need to add a Custom Post type to your theme with or without plugin. Below there is a snippet for build product CPT:

// Register Custom Post Type function products_post_type() {

$labels = array(
	'name'                  => _x( 'Products', 'Post Type General Name', 'text_domain' ),
	'singular_name'         => _x( 'Product', 'Post Type Singular Name', 'text_domain' ),
	'menu_name'             => __( 'Product', 'text_domain' ),
	'name_admin_bar'        => __( 'Post Type', 'text_domain' ),
	'archives'              => __( 'Item Archives', 'text_domain' ),
	'parent_item_colon'     => __( 'Parent Product:', 'text_domain' ),
	'all_items'             => __( 'All Products', 'text_domain' ),
	'add_new_item'          => __( 'Add New Product', 'text_domain' ),
	'add_new'               => __( 'New Product', 'text_domain' ),
	'new_item'              => __( 'New Item', 'text_domain' ),
	'edit_item'             => __( 'Edit Product', 'text_domain' ),
	'update_item'           => __( 'Update Product', 'text_domain' ),
	'view_item'             => __( 'View Product', 'text_domain' ),
	'search_items'          => __( 'Search products', 'text_domain' ),
	'not_found'             => __( 'No products found', 'text_domain' ),
	'not_found_in_trash'    => __( 'No products found in Trash', 'text_domain' ),
	'featured_image'        => __( 'Featured Image', 'text_domain' ),
	'set_featured_image'    => __( 'Set featured image', 'text_domain' ),
	'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
	'use_featured_image'    => __( 'Use as featured image', 'text_domain' ),
	'insert_into_item'      => __( 'Insert into item', 'text_domain' ),
	'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ),
	'items_list'            => __( 'Items list', 'text_domain' ),
	'items_list_navigation' => __( 'Items list navigation', 'text_domain' ),
	'filter_items_list'     => __( 'Filter items list', 'text_domain' ),
);
$args = array(
	'label'                 => __( 'Product', 'text_domain' ),
	'description'           => __( 'Product information pages', 'text_domain' ),
	'labels'                => $labels,
	'supports'              => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'custom-fields', ),
	'taxonomies'            => array( 'category', 'post_tag' ),
	'hierarchical'          => false,
	'public'                => true,
	'show_ui'               => true,
	'show_in_menu'          => true,
	'menu_position'         => 5,
	'show_in_admin_bar'     => true,
	'show_in_nav_menus'     => true,
	'can_export'            => true,
	'has_archive'           => true,		
	'exclude_from_search'   => false,
	'publicly_queryable'    => true,
	'capability_type'       => 'page',
);
register_post_type( 'product', $args );

} add_action( 'init', 'products_post_type', 0 );

=================================================

To install JSON API cpt just follow these steps:

  • Upload the folder "json-api-cpt" to your WordPress plugin folder (/wp-content/plugins)
  • Activate the plugin through the 'Plugins' menu in WordPress or by using the link provided by the plugin installer
  • Activate the controller through the JSON API menu found in the WordPress admin center (Settings -> JSON API)

==Screenshots==

==Changelog==

= 1.0 =

  • Initial release.

About

Extends the JSON API WordPress plugin for RESTful CPT get, edit, add, update and delete any kind of post type

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages