Guest User

Untitled

a guest
Jan 16th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.49 KB | None | 0 0
  1. $args1 = array(
  2. 'type' => 'string',
  3. 'description' => 'Published Date',
  4. 'single' => true,
  5. 'show_in_rest' => true
  6. );
  7. register_meta( 'post', 'book_publish_date', $args1 );
  8.  
  9. $args1 = array(
  10. 'type' => 'string',
  11. 'description' => 'Published Date',
  12. 'single' => true,
  13. 'show_in_rest' => true
  14. );
  15. register_meta( 'book', 'book_publish_date', $args1 );
  16.  
  17. function create_book_author() {
  18.  
  19. $labels = array(
  20. 'name' => 'Identifiers',
  21. 'singular_name' => 'Identifier',
  22. 'menu_name' => 'Book Identifiers',
  23. 'all_items' => 'All Identifiers',
  24. 'parent_item' => 'Parent Identifier',
  25. 'parent_item_colon' => 'Parent Identifier:',
  26. 'new_item_name' => 'New Identifier Name',
  27. 'add_new_item' => 'Add New Identifier',
  28. 'edit_item' => 'Edit Identifier',
  29. 'update_item' => 'Update Identifier',
  30. 'view_item' => 'View Identifier',
  31. 'separate_items_with_commas' => 'Separate Identifiers with commas',
  32. 'add_or_remove_items' => 'Add or remove Identifiers',
  33. 'choose_from_most_used' => 'Choose from the most used',
  34. 'popular_items' => 'Popular Identifiers',
  35. 'search_items' => 'Search Identifiers',
  36. 'not_found' => 'Not Found',
  37. 'no_terms' => 'No Identifiers',
  38. 'items_list' => 'Identifiers list',
  39. 'items_list_navigation' => 'Identifiers list navigation',
  40. );
  41. $rewrite = array(
  42. 'slug' => 'bookid',
  43. 'with_front' => true,
  44. 'hierarchical' => false,
  45. );
  46. $args = array(
  47. 'labels' => $labels,
  48. 'hierarchical' => false,
  49. 'public' => true,
  50. 'show_ui' => true,
  51. 'show_admin_column' => false,
  52. 'show_in_nav_menus' => true,
  53. 'show_tagcloud' => true,
  54. 'rewrite' => $rewrite,
  55. 'show_in_rest' => true,
  56. 'rest_base' => 'identifiers',
  57. );
  58. register_taxonomy( 'book_id', array( 'book' ), $args );
  59.  
  60. {
  61. "namespace": "wp/v2",
  62. "methods": [
  63. "GET",
  64. "POST"
  65. ],
  66. "endpoints": [
  67. {
  68. "methods": [
  69. "GET"
  70. ],
  71. "args": {
  72. "context": {
  73. "required": false,
  74. "default": "view",
  75. "enum": [
  76. "view",
  77. "embed",
  78. "edit"
  79. ],
  80. "description": "Scope under which the request is made; determines fields present in response.",
  81. "type": "string"
  82. },
  83. "page": {
  84. "required": false,
  85. "default": 1,
  86. "description": "Current page of the collection.",
  87. "type": "integer"
  88. },
  89. "per_page": {
  90. "required": false,
  91. "default": 10,
  92. "description": "Maximum number of items to be returned in result set.",
  93. "type": "integer"
  94. },
  95. "search": {
  96. "required": false,
  97. "description": "Limit results to those matching a string.",
  98. "type": "string"
  99. },
  100. "after": {
  101. "required": false,
  102. "description": "Limit response to posts published after a given ISO8601 compliant date.",
  103. "type": "string"
  104. },
  105. "before": {
  106. "required": false,
  107. "description": "Limit response to posts published before a given ISO8601 compliant date.",
  108. "type": "string"
  109. },
  110. "exclude": {
  111. "required": false,
  112. "default": [
  113. ],
  114. "description": "Ensure result set excludes specific IDs.",
  115. "type": "array",
  116. "items": {
  117. "type": "integer"
  118. }
  119. },
  120. "include": {
  121. "required": false,
  122. "default": [
  123. ],
  124. "description": "Limit result set to specific IDs.",
  125. "type": "array",
  126. "items": {
  127. "type": "integer"
  128. }
  129. },
  130. "offset": {
  131. "required": false,
  132. "description": "Offset the result set by a specific number of items.",
  133. "type": "integer"
  134. },
  135. "order": {
  136. "required": false,
  137. "default": "desc",
  138. "enum": [
  139. "asc",
  140. "desc"
  141. ],
  142. "description": "Order sort attribute ascending or descending.",
  143. "type": "string"
  144. },
  145. "orderby": {
  146. "required": false,
  147. "default": "date",
  148. "enum": [
  149. "author",
  150. "date",
  151. "id",
  152. "include",
  153. "modified",
  154. "parent",
  155. "relevance",
  156. "slug",
  157. "include_slugs",
  158. "title"
  159. ],
  160. "description": "Sort collection by object attribute.",
  161. "type": "string"
  162. },
  163. "slug": {
  164. "required": false,
  165. "description": "Limit result set to posts with one or more specific slugs.",
  166. "type": "array",
  167. "items": {
  168. "type": "string"
  169. }
  170. },
  171. "status": {
  172. "required": false,
  173. "default": "publish",
  174. "description": "Limit result set to posts assigned one or more statuses.",
  175. "type": "array",
  176. "items": {
  177. "enum": [
  178. "publish",
  179. "future",
  180. "draft",
  181. "pending",
  182. "private",
  183. "trash",
  184. "auto-draft",
  185. "inherit",
  186. "any"
  187. ],
  188. "type": "string"
  189. }
  190. },
  191. "authors": {
  192. "required": false,
  193. "default": [
  194. ],
  195. "description": "Limit result set to all items that have the specified term assigned in the authors taxonomy.",
  196. "type": "array",
  197. "items": {
  198. "type": "integer"
  199. }
  200. },
  201. "authors_exclude": {
  202. "required": false,
  203. "default": [
  204. ],
  205. "description": "Limit result set to all items except those that have the specified term assigned in the authors taxonomy.",
  206. "type": "array",
  207. "items": {
  208. "type": "integer"
  209. }
  210. }
  211. }
  212. },
  213. {
  214. "methods": [
  215. "POST"
  216. ],
  217. "args": {
  218. "date": {
  219. "required": false,
  220. "description": "The date the object was published, in the site's timezone.",
  221. "type": "string"
  222. },
  223. "date_gmt": {
  224. "required": false,
  225. "description": "The date the object was published, as GMT.",
  226. "type": "string"
  227. },
  228. "slug": {
  229. "required": false,
  230. "description": "An alphanumeric identifier for the object unique to its type.",
  231. "type": "string"
  232. },
  233. "status": {
  234. "required": false,
  235. "enum": [
  236. "publish",
  237. "future",
  238. "draft",
  239. "pending",
  240. "private"
  241. ],
  242. "description": "A named status for the object.",
  243. "type": "string"
  244. },
  245. "password": {
  246. "required": false,
  247. "description": "A password to protect access to the content and excerpt.",
  248. "type": "string"
  249. },
  250. "title": {
  251. "required": false,
  252. "description": "The title for the object.",
  253. "type": "object"
  254. },
  255. "content": {
  256. "required": false,
  257. "description": "The content for the object.",
  258. "type": "object"
  259. },
  260. "excerpt": {
  261. "required": false,
  262. "description": "The excerpt for the object.",
  263. "type": "object"
  264. },
  265. "comment_status": {
  266. "required": false,
  267. "enum": [
  268. "open",
  269. "closed"
  270. ],
  271. "description": "Whether or not comments are open on the object.",
  272. "type": "string"
  273. },
  274. "ping_status": {
  275. "required": false,
  276. "enum": [
  277. "open",
  278. "closed"
  279. ],
  280. "description": "Whether or not the object can be pinged.",
  281. "type": "string"
  282. },
  283. "meta": {
  284. "required": false,
  285. "description": "Meta fields.",
  286. "type": "object"
  287. },
  288. "template": {
  289. "required": false,
  290. "description": "The theme file to use to display the object.",
  291. "type": "string"
  292. },
  293. "authors": {
  294. "required": false,
  295. "description": "The terms assigned to the object in the book_id taxonomy.",
  296. "type": "array",
  297. "items": {
  298. "type": "integer"
  299. }
  300. }
  301. }
  302. }
  303. ],
  304. "schema": {
  305. "$schema": "http://json-schema.org/draft-04/schema#",
  306. "title": "book",
  307. "type": "object",
  308. "properties": {
  309. "date": {
  310. "description": "The date the object was published, in the site's timezone.",
  311. "type": "string",
  312. "format": "date-time",
  313. "context": [
  314. "view",
  315. "edit",
  316. "embed"
  317. ]
  318. },
  319. "date_gmt": {
  320. "description": "The date the object was published, as GMT.",
  321. "type": "string",
  322. "format": "date-time",
  323. "context": [
  324. "view",
  325. "edit"
  326. ]
  327. },
  328. "guid": {
  329. "description": "The globally unique identifier for the object.",
  330. "type": "object",
  331. "context": [
  332. "view",
  333. "edit"
  334. ],
  335. "readonly": true,
  336. "properties": {
  337. "raw": {
  338. "description": "GUID for the object, as it exists in the database.",
  339. "type": "string",
  340. "context": [
  341. "edit"
  342. ],
  343. "readonly": true
  344. },
  345. "rendered": {
  346. "description": "GUID for the object, transformed for display.",
  347. "type": "string",
  348. "context": [
  349. "view",
  350. "edit"
  351. ],
  352. "readonly": true
  353. }
  354. }
  355. },
  356. "id": {
  357. "description": "Unique identifier for the object.",
  358. "type": "integer",
  359. "context": [
  360. "view",
  361. "edit",
  362. "embed"
  363. ],
  364. "readonly": true
  365. },
  366. "link": {
  367. "description": "URL to the object.",
  368. "type": "string",
  369. "format": "uri",
  370. "context": [
  371. "view",
  372. "edit",
  373. "embed"
  374. ],
  375. "readonly": true
  376. },
  377. "modified": {
  378. "description": "The date the object was last modified, in the site's timezone.",
  379. "type": "string",
  380. "format": "date-time",
  381. "context": [
  382. "view",
  383. "edit"
  384. ],
  385. "readonly": true
  386. },
  387. "modified_gmt": {
  388. "description": "The date the object was last modified, as GMT.",
  389. "type": "string",
  390. "format": "date-time",
  391. "context": [
  392. "view",
  393. "edit"
  394. ],
  395. "readonly": true
  396. },
  397. "slug": {
  398. "description": "An alphanumeric identifier for the object unique to its type.",
  399. "type": "string",
  400. "context": [
  401. "view",
  402. "edit",
  403. "embed"
  404. ]
  405. },
  406. "status": {
  407. "description": "A named status for the object.",
  408. "type": "string",
  409. "enum": [
  410. "publish",
  411. "future",
  412. "draft",
  413. "pending",
  414. "private"
  415. ],
  416. "context": [
  417. "view",
  418. "edit"
  419. ]
  420. },
  421. "type": {
  422. "description": "Type of Post for the object.",
  423. "type": "string",
  424. "context": [
  425. "view",
  426. "edit",
  427. "embed"
  428. ],
  429. "readonly": true
  430. },
  431. "password": {
  432. "description": "A password to protect access to the content and excerpt.",
  433. "type": "string",
  434. "context": [
  435. "edit"
  436. ]
  437. },
  438. "title": {
  439. "description": "The title for the object.",
  440. "type": "object",
  441. "context": [
  442. "view",
  443. "edit",
  444. "embed"
  445. ],
  446. "properties": {
  447. "raw": {
  448. "description": "Title for the object, as it exists in the database.",
  449. "type": "string",
  450. "context": [
  451. "edit"
  452. ]
  453. },
  454. "rendered": {
  455. "description": "HTML title for the object, transformed for display.",
  456. "type": "string",
  457. "context": [
  458. "view",
  459. "edit",
  460. "embed"
  461. ],
  462. "readonly": true
  463. }
  464. }
  465. },
  466. "content": {
  467. "description": "The content for the object.",
  468. "type": "object",
  469. "context": [
  470. "view",
  471. "edit"
  472. ],
  473. "properties": {
  474. "raw": {
  475. "description": "Content for the object, as it exists in the database.",
  476. "type": "string",
  477. "context": [
  478. "edit"
  479. ]
  480. },
  481. "rendered": {
  482. "description": "HTML content for the object, transformed for display.",
  483. "type": "string",
  484. "context": [
  485. "view",
  486. "edit"
  487. ],
  488. "readonly": true
  489. },
  490. "protected": {
  491. "description": "Whether the content is protected with a password.",
  492. "type": "boolean",
  493. "context": [
  494. "view",
  495. "edit",
  496. "embed"
  497. ],
  498. "readonly": true
  499. }
  500. }
  501. },
  502. "excerpt": {
  503. "description": "The excerpt for the object.",
  504. "type": "object",
  505. "context": [
  506. "view",
  507. "edit",
  508. "embed"
  509. ],
  510. "properties": {
  511. "raw": {
  512. "description": "Excerpt for the object, as it exists in the database.",
  513. "type": "string",
  514. "context": [
  515. "edit"
  516. ]
  517. },
  518. "rendered": {
  519. "description": "HTML excerpt for the object, transformed for display.",
  520. "type": "string",
  521. "context": [
  522. "view",
  523. "edit",
  524. "embed"
  525. ],
  526. "readonly": true
  527. },
  528. "protected": {
  529. "description": "Whether the excerpt is protected with a password.",
  530. "type": "boolean",
  531. "context": [
  532. "view",
  533. "edit",
  534. "embed"
  535. ],
  536. "readonly": true
  537. }
  538. }
  539. },
  540. "comment_status": {
  541. "description": "Whether or not comments are open on the object.",
  542. "type": "string",
  543. "enum": [
  544. "open",
  545. "closed"
  546. ],
  547. "context": [
  548. "view",
  549. "edit"
  550. ]
  551. },
  552. "ping_status": {
  553. "description": "Whether or not the object can be pinged.",
  554. "type": "string",
  555. "enum": [
  556. "open",
  557. "closed"
  558. ],
  559. "context": [
  560. "view",
  561. "edit"
  562. ]
  563. },
  564. "meta": {
  565. "description": "Meta fields.",
  566. "type": "object",
  567. "context": [
  568. "view",
  569. "edit"
  570. ],
  571. "properties": {
  572. "book_language": {
  573. "type": "string",
  574. "description": "Books language should be standardized to ISO 639-2",
  575. "default": null
  576. },
  577. "book_series": {
  578. "type": "string",
  579. "description": "Series Name",
  580. "default": null
  581. },
  582. "book_series_number": {
  583. "type": "integer",
  584. "description": "Series Number Integer",
  585. "default": null
  586. },
  587. "book_file_id": {
  588. "type": "string",
  589. "description": "File Server ID",
  590. "default": null
  591. },
  592. "book_publish_date": {
  593. "type": "string",
  594. "description": "Published Date",
  595. "default": null
  596. }
  597. }
  598. },
  599. "template": {
  600. "description": "The theme file to use to display the object.",
  601. "type": "string",
  602. "context": [
  603. "view",
  604. "edit"
  605. ]
  606. },
  607. "authors": {
  608. "description": "The terms assigned to the object in the book_id taxonomy.",
  609. "type": "array",
  610. "items": {
  611. "type": "integer"
  612. },
  613. "context": [
  614. "view",
  615. "edit"
  616. ]
  617. }
  618. }
  619. },
  620. "_links": {
  621. "self": "http://wordpress.ebook.dev/index.php/wp-json/wp/v2/books"
  622. }
  623. }
Add Comment
Please, Sign In to add comment